Learn R Programming

RTextTools (version 1.4.3)

as.compressed.matrix: converts a tm DocumentTermMatrix or TermDocumentMatrix into a matrix.csr representation.

Description

Converts a DocumentTermMatrix or TermDocumentMatrix (package tm), Matrix (package Matrix), matrix.csr (SparseM), data.frame, or matrix into a matrix.csr representation to be used in the RTextTools functions.

Usage

as.compressed.matrix(DocumentTermMatrix)

Arguments

DocumentTermMatrix

A class of type DocumentTermMatrix or TermDocumentMatrix (package tm), Matrix (package Matrix), matrix.csr (SparseM), data.frame, or matrix.

Value

A matrix.csr representation of the DocumentTermMatrix or TermDocumentMatrix (package tm), Matrix (package Matrix), matrix.csr (SparseM), data.frame, or matrix.