Tuesday 15 May 2012

text mining - R build TermDocumentMatrix with removeSparseTerms parameter -



text mining - R build TermDocumentMatrix with removeSparseTerms parameter -

am able remove sparse terms while creating tm::termdocumentmatrix object?

i tried:

termdocumentmatrix(file.corp, command = list(removesparseterms=0.998))

but not work.

no, cannot remove sparse terms termdocumentmatrix function. if check help function ?termdocumentmatrix you'll see options control listed in help termfreq, , when @ help function ?termfreq, you'll see removesparseterms not listed there. although have bounds can related job.

if want one-liner combines termdocumentmatrix , removesparseterms, flip line inside-out , work fine:

removesparseterms(termdocumentmatrix(file.corp), 0.998)

i recommend have careful @ documentation tm package, it's 1 of improve examples of well-documented contributed package. might save time waiting reply questions here!

r text-mining tm term-document-matrix

No comments:

Post a Comment