List the most (or least) frequently occuring features in a dfm.

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

Arguments

x
the object whose features will be returned
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

# most frequent features topfeatures(dfm(corpus_subset(data_corpus_inaugural, Year > 1980), verbose = FALSE))
#> , the . and of to our we a in #> 1342 1100 1074 927 761 584 565 539 426 337
topfeatures(dfm(corpus_subset(data_corpus_inaugural, Year > 1980), remove = stopwords("english"), verbose = FALSE))
#> , . will - us ; must america new people #> 1342 1074 233 195 165 105 99 98 93 90
# least frequent features topfeatures(dfm(corpus_subset(data_corpus_inaugural, Year > 1980), verbose = FALSE), decreasing = FALSE)
#> hatfield mondale baker moomaw momentous occurrence routinely #> 1 1 1 1 1 1 1 #> unique really normal #> 1 1 1