TermDocMatrix {tm}R Documentation

Term-Document Matrix

Description

Constructs a term-document matrix.

Usage

TermDocMatrix(object, control = list())

Arguments

object a text document collection
control a named list of control options. The component 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.

Value

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.

Author(s)

Ingo Feinerer

See Also

The documentation to termFreq gives an extensive list of possible options.

Available weighting functions shipped with this package are weightTf, weightTfIdf, weightBin and weightLogical.

Examples

data("crude")
(tdm <- TermDocMatrix(crude, control = list(weighting = weightTfIdf, stopwords = TRUE)))

[Package tm version 0.3-3 Index]