dfm_sort {quanteda} | R Documentation |
Sort a dfm by frequency of one or more margins
Description
Sorts a dfm by descending frequency of total features, total features in documents, or both.
Usage
dfm_sort(x, decreasing = TRUE, margin = c("features", "documents", "both"))
Arguments
x |
Document-feature matrix created by |
decreasing |
logical; if |
margin |
which margin to sort on |
Value
A sorted dfm matrix object
Author(s)
Ken Benoit
Examples
dfmat <- dfm(tokens(data_corpus_inaugural))
head(dfmat)
head(dfm_sort(dfmat))
head(dfm_sort(dfmat, decreasing = FALSE, "both"))
[Package quanteda version 4.0.2 Index]