Last chance! 50% off unlimited learning
Sale ends in
"sort"(x, decreasing = TRUE, margin = c("features", "docs", "both"), ...)
dfm
features
to sort by frequency of
features, docs
to sort by total feature counts in documents, and
both
to sort by bothsort.int
dtm <- dfm(inaugCorpus)
dtm[1:10, 1:5]
dtm <- sort(dtm)
sort(dtm)[1:10, 1:5]
sort(dtm, TRUE, "both")[1:10, 1:5] # note that the decreasing=TRUE argument
# must be second, because of the order of the
# formals in the generic method of sort()
Run the code above in your browser using DataLab