
Last chance! 50% off unlimited learning
Sale ends in
Sorts a dfm by descending frequency of total features, total features in documents, or both.
dfm_sort(x, decreasing = TRUE, margin = c("features", "documents", "both"))
Document-feature matrix created by dfm
logical; if TRUE
, the sort will be in descending
order, otherwise sort in increasing order
which margin to sort on features
to sort by frequency of
features, documents
to sort by total feature counts in documents,
and both
to sort by both
A sorted dfm matrix object
# NOT RUN {
dtm <- dfm(data_corpus_inaugural)
head(dtm)
head(dfm_sort(dtm))
head(dfm_sort(dtm, decreasing = FALSE, "both"))
# }
Run the code above in your browser using DataLab