Learn R Programming

quanteda (version 0.9.7-17)

topfeatures: list the most frequent features

Description

List the most frequently occuring features in a dfm

Usage

topfeatures(x, ...)
"topfeatures"(x, n = 10, decreasing = TRUE, ci = 0.95, ...)
"topfeatures"(x, n = 10, decreasing = TRUE, ...)

Arguments

x
the object whose features will be returned
...
additional arguments passed to other methods
n
how many top features should be returned
decreasing
If TRUE, return the n most frequent features, if FALSE, return the n least frequent features
ci
confidence interval from 0-1.0 for use if dfm is resampled

Value

A named numeric vector of feature counts, where the names are the feature labels.

Examples

Run this code
topfeatures(dfm(subset(inaugCorpus, Year>1980), verbose=FALSE))
topfeatures(dfm(subset(inaugCorpus, Year>1980), ignoredFeatures=stopwords("english"),
            verbose=FALSE))
# least frequent features
topfeatures(dfm(subset(inaugCorpus, Year>1980), verbose=FALSE), decreasing=FALSE)

Run the code above in your browser using DataLab