Description Usage Arguments Value Note Examples
View source: R/corpus_functions.R
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.
1 |
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.
1 2 3 4 5 6 7 8 9 10 11 | # 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 ]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.