| removeSparseTerms {tm} | R Documentation |
Remove sparse terms from a term-document matrix.
removeSparseTerms(object, sparse)
object |
A term-document matrix. |
sparse |
a numeric for the maximal allowed sparsity |
A term-document matrix where those terms from object are
removed which have at least a sparse percentage of empty (i.e.,
terms occurring 0 times in a document) elements. I.e., the resulting
matrix contains only terms with a sparse factor of less than
sparse.
data("crude")
tdm <- TermDocumentMatrix(crude)
removeSparseTerms(tdm, 0.2)