TermDocMatrix {tm} | R Documentation |
Constructs a term-document matrix.
TermDocMatrix(object, control = list())
object |
a text document collection |
control |
a list of control options. The option weighting
must be a weighting function capable of handling a
dgCMatrix . It defaults to weightTf for term frequency
weighting. All other options are delegated internally to a
termFreq call. |
An S4 object of class TermDocMatrix
containing a sparse term-document
matrix. The following slots contain useful information:
Data |
The sparse Matrix |
Weighting |
The weighting mode applied to the term-document matrix |
Ingo Feinerer
The documentation to termFreq
gives an extensive list of
possible options.
Available weighting functions shipped with this
package are weightTf
, weightTfIdf
,
weightBin
and weightLogical
.
data("crude") (tdm <- TermDocMatrix(crude, control = list(weighting = weightTfIdf, stopwords = TRUE)))