Tidy a DocumentTermMatrix or TermDocumentMatrix into
a three-column data frame: term{}
, and value (with
zeros missing), with one-row-per-term-per-document.
# S3 method for DocumentTermMatrix
tidy(x, ...)# S3 method for TermDocumentMatrix
tidy(x, ...)
# S3 method for dfm
tidy(x, ...)
# S3 method for dfmSparse
tidy(x, ...)
# S3 method for simple_triplet_matrix
tidy(x, row_names = NULL, col_names = NULL,
...)
A DocumentTermMatrix or TermDocumentMatrix object
Extra arguments, not used
Specify row names
Specify column names
# NOT RUN {
if (requireNamespace("topicmodels", quietly = TRUE)) {
data("AssociatedPress", package = "topicmodels")
AssociatedPress
tidy(AssociatedPress)
}
# }
Run the code above in your browser using DataLab