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. Supported by the European Research Council grant ERC-2011-StG 283794-QUANTESS.

For more details, see https://docs.quanteda.io/index.html.

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++ and Fortran source code, you will need to have installed the appropriate compilers.

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 should install the macOS tools, namely the Clang 6.x compiler and the GNU Fortran compiler (as quanteda requires gfortran to build).

How to Use

See the quick start guide 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.3.4

License

GPL-3

Maintainer

Kenneth Benoit

Last Published

July 15th, 2018

Functions in quanteda (1.3.4)

as.corpus.corpuszip

Coerce a compressed corpus to a standard corpus
as.data.frame.dfm

Convert a dfm to a data.frame
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_*.
as.dist.dist

Coerce a dist into a dist
as.fcm

Coercion functions for fcm objects
as.yaml

Convert quanteda dictionary objects to the YAML format
as.igraph

Convert an fcm to an igraph object
as.list.dist

Coerce a dist object into a list
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
dfm

Create a document-feature matrix
dfm-internal

Internal functions for dfm objects
dfm_subset

Extract a subset of a dfm
dfm_group

Combine documents in a dfm by a grouping variable
dfm_tfidf

Weight a dfm by tf-idf
dfm_lookup

Apply a dictionary to a dfm
as.dfm

Coercion and checking functions for dfm objects
View

View methods for quanteda
escape_regex

Internal function for select_types() to escape regular expressions
as.dictionary

Coercion and checking functions for dictionary objects
affinity

Internal function to fit the likelihood scaling mixture model.
dfm_tolower

Convert the case of the features of a dfm and combine
expand

Simpler and faster version of expand.grid() in base package
attributes<-

Function extending base::attributes()
as.matrix.dist_selection

Coerce a dist_selection object to a matrix
as.summary.textmodel

Assign the summary.textmodel class to a list
head.dfm

Return the first or last part of a dfm
corpus

Construct a corpus object
influence.predict.textmodel_affinity

Compute feature influence from a predicted textmodel_affinity object
as.tokens

Coercion, checking, and combining functions for tokens objects
as.matrix.simil

Coerce a simil object into a matrix
convert

Convert a dfm to a non-quanteda format
coef.textmodel_ca

Extract model coefficients from a fitted textmodel_ca object
convert-wrappers

Convenience wrappers for dfm convert
is_indexed

Check if a glob pattern is indexed by index_types
corpus-class

Base method extensions for corpus objects
is_regex

Internal function for select_types() to check if a string is a regular expression
ndoc

Count the number of documents or features
as.coefficients_textmodel

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

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

Utility function to create a object with new set of attributes
nest_dictionary

Utility function to generate a nested list
data-deprecated

Datasets with deprecated or defunct names
dfm_trim

Trim a dfm using frequency threshold-based feature selection
corpus_reshape

Recast the document units of a corpus
data_corpus_dailnoconf1991

Confidence debate from 1991 Irish Parliament
predict.textmodel_affinity

Prediction for a fitted affinity textmodel
metacorpus

Get or set corpus metadata
as.corpus

coerce a compressed corpus to a standard corpus
data_dictionary_LSD2015

Lexicoder Sentiment Dictionary (2015)
dfm-class

Virtual class "dfm" for a document-feature matrix
predict.textmodel_nb

Prediction from a fitted textmodel_nb object
metadoc

Get or set document-level meta-data
data_corpus_inaugural

US presidential inaugural address texts
data-internal

Internal data sets
dfm2lsa

Convert a dfm to an lsa "textmatrix"
as.list.dist_selection

Coerce a dist_selection object into a list
dfm_compress

Recombine a dfm or fcm by combining identical dimension elements
print.textmodel_wordfish

print method for a wordfish model
data_char_sampletext

A paragraph of text for testing various text-based functions
as.matrix.dfm

Coerce a dfm to a matrix or data.frame
pattern

Pattern for feature, token and keyword matching
data_char_ukimmig2010

Immigration-related sections of 2010 UK party manifestos
pattern2id

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

Replace features in dfm
dfm_select

Select features from a dfm or fcm
bootstrap_dfm

Bootstrap a dfm
dfm_sort

Sort a dfm by frequency of one or more margins
friendly_class_undefined_message

Print friendly object class not defined message
print.dist_selection

Print a dist_selection object
generate_groups

Generate a grouping vector from docvars
quanteda-package

An R package for the quantitative analysis of textual data
docnames

Get or set document names
docvars

Get or set document-level variables
fcm-class

cbind.dfm

Combine dfm objects by Rows or Columns
print.phrases

Print a phrase object
fcm

Create a feature co-occurrence matrix
keyness

Compute keyness (internal functions)
pattern2list

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

Set values to a fcm's S4 slots
set_dfm_slots

Set values to a dfm's S4 slots
kwic

Locate keywords-in-context
textmodel_lsa-postestimation

Post-estimations methods for textmodel_lsa
replace_dictionary_values

Internal function to replace dictionary values
dfm_sample

Randomly sample documents or features from a dfm
phrase

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

Count syllables in a text
scrabble

Deprecated name for nscrabble
predict.textmodel_wordfish

Prediction from a textmodel_wordfish method
textmodel_lsa

Latent Semantic Analysis
settings

Get or set the corpus settings
textplot_network

Plot a network of feature co-occurrences
predict.textmodel_wordscores

Predict textmodel_wordscores
tf

deprecated name for dfm_weight
search_glob

Select types without performing slow regex search
textplot_scale1d

Plot a fitted scaling model
slots<-

Function to assign multiple slots to a S4 object
search_index

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

Select or remove tokens from a tokens object
tfidf

textmodel_wordscores

Wordscores text model
ntoken

Count the number of tokens or types
textmodel_wordshoal

Wordshoal text model (redirect)
corpus_sample

Randomly sample documents from a corpus
corpus_segment

Segment texts on a pattern match
summary.character

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

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

Get or set package options for quanteda
read_dict_liwc

Import a LIWC-formatted dictionary
spacyr-methods

Extensions for and from spacy_parse objects
data_corpus_irishbudget2010

Irish budget speeches from 2010
texts

Get or assign corpus texts
textstat_collocations

Identify and score multi-word expressions
dfm_weight

Weight the feature frequencies in a dfm
groups

Grouping variable(s) for various functions
dictionary2-class

Print a dictionary object
docfreq

Compute the (weighted) document frequency of a feature
dictionary

Create a dictionary
sparsity

Compute the sparsity of a document-feature matrix
summary.corpus

Summarize a corpus
head.corpus

Return the first or last part of a corpus
textstat_select

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

Internal function to convert a list to a dictionary
tokens_serialize

Function to serialized list-of-character tokens
fcm_sort

Sort an fcm in alphabetical order of the features
featnames

Get the feature labels from a dfm
textplot_influence

Influence plot for text scaling models
textmodel_ca

Correspondence analysis of a document-feature matrix
textstat_dist

Similarity and distance computation between documents or features
tokens_ngrams

Create ngrams and skipgrams from tokens
topfeatures

Identify the most frequent features in a dfm
matrix2fcm

Conversts a Matrix to a fcm
textmodel_affinity

Class affinity maximum likelihood text scaling model
tokens_recompile

recompile a serialized tokens object
textstat_frequency

Tabulate feature frequencies
unused_dots

Raise warning of unused dots
types

Get word types from a tokens object
merge_dictionary_values

Internal function to merge values of duplicated keys
valuetype

Pattern matching using valuetype
print.statistics_textmodel

Implements print methods for textmodel_statistics
textplot_keyness

Plot word keyness
print.summary.textmodel

print method for summary.textmodel
summary_character

Summary statistics on a character vector
textstat_keyness

Calculate keyness statistics
textmodel_affinity-internal

Internal methods for textmodel_affinity
matrix2dfm

Conversts a Matrix to a dfm
tokens

Tokenize a set of texts
tokens_compound

Convert token sequences into compound tokens
textstat_lexdiv

Calculate lexical diversity
nsentence

Count the number of sentences
nscrabble

Count the Scrabble letter values of text
textstat_readability

Calculate readability
textplot_wordcloud

Plot features as a wordcloud
textplot_xray

Plot the dispersion of key word(s)
tokens_tortl

[Experimental] Change direction of words in tokens
tokens_subset

Extract a subset of a tokens
tokens_group

Recombine documents tokens by groups
print.coefficients_textmodel

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

Stem the terms in an object
tokens_tolower

Convert the case of tokens
print.dfm

Print a dfm object
wordcloud

Internal function for textplot_wordcloud
reexports

Objects exported from other packages
tokens_lookup

Apply a dictionary to a tokens object
tokens_replace

Replace types in tokens object
remove_empty_keys

Utility function to remove empty keys
wordcloud_comparison

Internal function for textplot_wordcloud
tokens_segment

Segment tokens object by patterns
summary.textmodel_nb

summary method for textmodel_nb objects
summary.textmodel_wordfish

summary method for textmodel_wordfish
textmodel_nb

Naive Bayes classifier for texts
textmodel_wordfish

Wordfish text model