dtm_matrix.Rd
Creates a simple sparse matrix of document_term_matrix
object.
dtm_matrix(dtm, density) # S3 method for dtm dtm_matrix(dtm, density = c("sparse", "dense"))
dtm | An object of class |
---|---|
density | Whether to return a |
# NOT RUN { init_textanalysis() # build document doc1 <- string_document("First document.") doc2 <- string_document("Second document.") corpus <- corpus(doc1, doc2) update_lexicon(corpus) m <- document_term_matrix(corpus) dtm_matrix(m) # sparse dtm_matrix(m, "dense") # dense # }