The removeCommonTerms function is found here for the TM package so that
removeCommonTerms <- function (x, pct) { stopifnot(inherits(x, c("DocumentTermMatrix", "TermDocumentMatrix")), is.numeric(pct), pct > 0, pct < 1) m <- if (inherits(x, "DocumentTermMatrix")) t(x) else x t <- table(m$i) < m$ncol * (pct) termIndex <- as.numeric(names(t[t])) if (inherits(x, "DocumentTermMatrix")) x[, termIndex] else x[termIndex, ] }
Now I would like to remove terms that are too general with the Quanteda package. I could do this deletion before creating the Document property matrix or using the document property matrix.
How to remove too general terms with the Quanteda package in R?
source share