Learn R Programming

tm (version 0.3-1)

number: The Number of Rows/Columns/Dimensions/Documents/Terms of a Term-Document Matrix

Description

Return the number of rows, columns, dimensions, documents, and terms of a term-document matrix or a document-term matrix.

Arguments

x
Either a term-document matrix or a document-term matrix.

Examples

Run this code
data("crude")
tdm <- TermDocumentMatrix(crude)[1:10,1:20]
ncol(tdm)
nrow(tdm)
dim(tdm)
nDocs(tdm)
nTerms(tdm)

Run the code above in your browser using DataLab