wordcounts_Matrix | R Documentation |
This function simply transforms a data frame like that from
read_wordcounts
into a document-term matrix (in
sparseMatrix]
format). That is, it converts
from long to wide format. This is useful in itself if you want to do
matrix manipulations and also a convenient format for interchange
with other text-mining packages.
wordcounts_Matrix(counts)
data |
frame with columns |
In particular, this function is meant to help with packages that
expect document-term matrices in the slam package's simple
triplet matrix type. A Matrix
can be automatically coerced to
a simple_triplet_matrix
.
sparse link[Matrix]{Matrix}
with documents in rows and words
in columns, with id and word values as dimnames
read_wordcounts
, instances_Matrix
for
the same conversion from MALLET's format
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.