| Dtm2Docs {textmineR} | R Documentation |
This function takes a sparse matrix (DTM) as input and returns a character vector whose length is equal to the number of rows of the input DTM.
Dtm2Docs(dtm, ...)
dtm |
A sparse Matrix from the matrix package whose rownames correspond to documents and colnames correspond to words |
... |
Other arguments to be passed to |
Returns a character vector. Each entry of this vector corresponds to the rows
of dtm.
This function performs parallel computation if dtm has more than 3,000
rows. The default is to use all available cores according to detectCores.
However, this can be modified by passing the cpus argument when calling
this function.
# Load a pre-formatted dtm and topic model data(nih_sample) data(nih_sample_dtm) # see the original documents nih_sample$ABSTRACT_TEXT[ 1:3 ] # see the new documents re-structured from the DTM new_docs <- Dtm2Docs(dtm = nih_sample_dtm) new_docs[ 1:3 ]