Learn R Programming

⚠️There's a newer version (4.2.0) of this package.Take me there.

About

An R package for managing and analyzing text, created by Kenneth Benoit in collaboration with a team of core contributors: Kohei Watanabe, Paul Nulty, Adam Obeng, Stefan Müller, Haiyan Wang, Ben Lauderdale, and Will Lowe.
Supported by the European Research Council grant ERC-2011-StG 283794-QUANTESS.

For more details, see http://docs.quanteda.io and the quanteda vignettes.

How to Install

The normal way from CRAN, using your R GUI or

install.packages("quanteda") 

Or for the latest development version:

# devtools package required to install quanteda from Github 
devtools::install_github("quanteda/quanteda") 

Because this compiles some C++ source code, you will need a compiler installed. If you are using a Windows platform, this means you will need also to install the Rtools software available from CRAN. If you are using macOS, you will need to to install XCode, available for free from the App Store, or if you prefer a lighter footprint set of tools, just the Xcode command line tools, using the command xcode-select --install from the Terminal.

How to Use

See the quick start quide to learn how to use quanteda.

Leaving Feedback

If you like quanteda, please consider leaving feedback or a testimonial here.

Contributing

Contributions in the form of feedback, comments, code, and bug reports are most welcome. How to contribute:

Copy Link

Version

Install

install.packages('quanteda')

Monthly Downloads

24,111

Version

1.2.0

License

GPL-3

Maintainer

Kenneth Benoit

Last Published

April 15th, 2018

Functions in quanteda (1.2.0)

as.fcm

Coercion functions for fcm objects
char_tolower

Convert the case of character objects
check_font

Check if font is available on the system
corpus_subset

Extract a subset of a corpus
corpus_trim

Remove sentences based on their token lengths or a pattern match
data_dictionary_LSD2015

Lexicoder Sentiment Dictionary (2015)
dfm-class

Virtual class "dfm" for a document-feature matrix
as.dictionary

Coercion and checking functions for dictionary objects
as.dist.dist

Coerce a dist into a dist
dfm_tolower

Convert the case of the features of a dfm and combine
as.network

redefinition of network::as.network()
as.statistics_textmodel

Coerce various objects to statistics_textmodel This is a helper function used in summary.textmodel_*.
dfm_trim

Trim a dfm using frequency threshold-based feature selection
fcm-class

coef.textmodel_ca

Extract model coefficients from a fitted textmodel_ca object
convert-wrappers

Convenience wrappers for dfm convert
data_char_sampletext

A paragraph of text for testing various text-based functions
fcm

Create a feature co-occurrence matrix
fcm_sort

Sort an fcm in alphabetical order of the features
data_char_ukimmig2010

Immigration-related sections of 2010 UK party manifestos
as.coefficients_textmodel

Coerce various objects to coefficients_textmodel This is a helper function used in summary.textmodel_*.
featnames

Get the feature labels from a dfm
as.corpus

coerce a compressed corpus to a standard corpus
as.summary.textmodel

Assign the summary.textmodel class to a list
as.corpus.corpuszip

Coerce a compressed corpus to a standard corpus
as.tokens

Coercion, checking, and combining functions for tokens objects
data_corpus_dailnoconf1991

Confidence debate from 1991 Irish Parliament
as.dfm

Coercion and checking functions for dfm objects
as.yaml

Convert quanteda dictionary objects to the YAML format
data_corpus_inaugural

US presidential inaugural address texts
metacorpus

Get or set corpus metadata
bootstrap_dfm

Bootstrap a dfm
metadoc

Get or set document-level meta-data
cbind.dfm

Combine dfm objects by Rows or Columns
dfm_subset

Extract a subset of a dfm
nsyllable

Count syllables in a text
dfm_tfidf

Weight a dfm by tf-idf
ntoken

Count the number of tokens or types
View

View methods for quanteda
corpus_trimsentences

Remove sentences based on their token lengths or a pattern match
affinity

Internal function to fit the likelihood scaling mixture model.
dictionary

Create a dictionary
create

Utility function to create a object with new set of attributes
print.coefficients_textmodel

Print methods for textmodel features estimates This is a helper function used in print.summary.textmodel.
as.matrix.dist_selection

Coerce a dist_selection object to a matrix
corpus

Construct a corpus object
as.matrix.simil

Coerce a simil object into a matrix
attributes<-

Function extending base::attributes()
convert

Convert a dfm to a non-quanteda format
corpus_reshape

Recast the document units of a corpus
dfm-internal

Internal functions for dfm objects
corpus-class

Base method extensions for corpus objects
corpus_sample

Randomly sample documents from a corpus
dfm

Create a document-feature matrix
data-deprecated

Datasets with deprecated or defunct names
dfm_sort

Sort a dfm by frequency of one or more margins
dfm_compress

Recombine a dfm or fcm by combining identical dimension elements
corpus_segment

Segment texts on a pattern match
data_corpus_irishbudget2010

Irish budget speeches from 2010
dfm_replace

Replace features in dfm
data-internal

Internal data sets
influence.predict.textmodel_affinity

Compute feature influence from a predicted textmodel_affinity object
head.dfm

Return the first or last part of a dfm
dfm_select

Select features from a dfm or fcm
docfreq

Compute the (weighted) document frequency of a feature
dfm_group

Combine documents in a dfm by a grouping variable
dfm2lsa

Convert a dfm to an lsa "textmatrix"
data_dfm_lbgexample

dfm from data in Table 1 of Laver, Benoit, and Garry (2003)
matrix2fcm

Conversts a Matrix to a fcm
dfm_sample

Randomly sample documents or features from a dfm
escape_regex

Internal function for select_types() to escape regular expressions
print.dfm

Print a dfm object
expand

Simpler and faster version of expand.grid() in base package
set_dfm_slots

Set values to a dfm's S4 slots
predict.textmodel_affinity

Prediction for a fitted affinity textmodel
predict.textmodel_nb

Prediction from a fitted textmodel_nb object
merge_dictionary_values

Internal function to merge values of duplicated keys
predict.textmodel_wordfish

Prediction from a textmodel_wordfish method
predict.textmodel_wordscores

Predict textmodel_wordscores
docnames

Get or set document names
groups

Grouping variable(s) for various functions
head.corpus

Return the first or last part of a corpus
reexports

Objects exported from other packages
remove_empty_keys

Utility function to remove empty keys
docvars

Get or set document-level variables
is_indexed

Check if a glob pattern is indexed by index_types
is_regex

Internal function for select_types() to check if a string is a regular expression
summary.textmodel_nb

summary method for textmodel_nb objects
summary.textmodel_wordfish

summary method for textmodel_wordfish
set_fcm_slots

Set values to a fcm's S4 slots
summary_character

Summary statistics on a character vector
dfm_lookup

Apply a dictionary to a dfm
textmodel_nb

Naive Bayes classifier for texts
textmodel_wordfish

Wordfish text model
keyness

Compute keyness (internal functions)
dfm_weight

Weight the feature frequencies in a dfm
nscrabble

Count the Scrabble letter values of text
nsentence

Count the number of sentences
textstat_readability

Calculate readability
kwic

Locate keywords-in-context
textstat_lexdiv

Calculate lexical diversity
tokens_select

Select or remove tokens from a tokens object
textmodel_wordscores

Wordscores text model
textmodel_wordshoal

Wordshoal text model (redirect)
tokens_lookup

Apply a dictionary to a tokens object
textmodel_affinity-internal

Internal methods for textmodel_affinity
tokens_group

Recombine documents tokens by groups
tokens_serialize

Function to serialized list-of-character tokens
textstat_keyness

Calculate keyness statistics
textstat_frequency

Tabulate feature frequencies
list2dictionary

Internal function to convert a list to a dictionary
dictionary2-class

Print a dictionary object
tokens_wordstem

Stem the terms in an object
topfeatures

Identify the most frequent features in a dfm
tokens_compound

Convert token sequences into compound tokens
friendly_class_undefined_message

Print friendly object class not defined message
print.dist_selection

Print a dist_selection object
matrix2dfm

Conversts a Matrix to a dfm
generate_groups

Generate a grouping vector from docvars
tokens

Tokenize a set of texts
pattern2id

Convert regex and glob patterns to type IDs or fixed patterns
pattern

Pattern for feature, token and keyword matching
quanteda_options

Get or set package options for quanteda
print.phrases

Print a phrase object
ndoc

Count the number of documents or features
nest_dictionary

Utility function to generate a nested list
pattern2list

Convert various input as pattern to a vector used in tokens_select, tokens_compound and kwic.
phrase

Declare a compound character to be a sequence of separate pattern matches
read_dict_liwc

Import a LIWC-formatted dictionary
quanteda-package

An R package for the quantitative analysis of textual data
print.textmodel_wordfish

print method for a wordfish model
settings

Get or set the corpus settings
slots<-

Function to assign multiple slots to a S4 object
print.summary.textmodel

print method for summary.textmodel
print.statistics_textmodel

Implements print methods for textmodel_statistics
replace_dictionary_values

Internal function to replace dictionary values
search_glob

Select types without performing slow regex search
scrabble

Deprecated name for nscrabble
textmodel_lsa-postestimation

Post-estimations methods for textmodel_lsa
search_index

Internal function for select_types to search the index using fastmatch.
textmodel_lsa

Latent Semantic Analysis
tokens_ngrams

Create ngrams and skipgrams from tokens
textplot_network

Plot a network of feature co-occurrences
spacyr-methods

Extensions for and from spacy_parse objects
textplot_scale1d

Plot a fitted scaling model
tokens_recompile

recompile a serialized tokens object
sparsity

Compute the sparsity of a document-feature matrix
tokens_subset

Extract a subset of a tokens
summary.character

summary.character method to override the network::summary.character()
textplot_influence

Influence plot for text scaling models
textplot_keyness

Plot word keyness
summary.corpus

Summarize a corpus
tokens_tolower

Convert the case of tokens
wordcloud

Internal function for textplot_wordcloud
textmodel_affinity

Class affinity maximum likelihood text scaling model
textmodel_ca

Correspondence analysis of a document-feature matrix
textplot_wordcloud

Plot features as a wordcloud
wordcloud_comparison

Internal function for textplot_wordcloud
texts

Get or assign corpus texts
textplot_xray

Plot the dispersion of key word(s)
tf

deprecated name for dfm_weight
types

Get word types from a tokens object
tfidf

textstat_collocations

Identify and score multi-word expressions
textstat_select

Select rows of textstat objects by glob, regex or fixed patterns
valuetype

Pattern matching using valuetype
textstat_dist

Similarity and distance computation between documents or features
tokens_replace

Replace types in tokens object
tokens_segment

Segment tokens object by patterns
as.list.dist

Coerce a dist object into a list
as.list.dist_selection

Coerce a dist_selection object into a list
as.matrix.dfm

Coerce a dfm to a matrix or data.frame