Learn R Programming

LDAShiny (version 0.9.2)

removeSparseTerms: removeSparseTerms Remove Sparse Terms from a Term-Document Matrix function original pakage tm

Description

removeSparseTerms Remove Sparse Terms from a Term-Document Matrix function original pakage tm

Usage

removeSparseTerms(x, sparse)

Arguments

x

A DocumentTermMatrix or a TermDocumentMatrix

sparse

A numeric for the maximal allowed sparsity in the range from bigger zero to smaller one.

Value

A term-document matrix where those terms from x 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

Examples

Run this code
# NOT RUN {
data("crude")
require(tm)
tdm <- tm::TermDocumentMatrix(crude)
removeSparseTerms(tdm, 0.3)
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab