Learn R Programming

tidytext (version 0.1.1)

tdm_tidiers: Tidy DocumentTermMatrix, TermDocumentMatrix, and related objects from the tm package

Description

Tidy a DocumentTermMatrix or TermDocumentMatrix into a three-column data frame: term{}, and value (with zeros missing), with one-row-per-term-per-document.

Usage

"tidy"(x, ...)
"tidy"(x, ...)
"tidy"(x, ...)
"tidy"(x, row_names = NULL, col_names = NULL, ...)

Arguments

x
A DocumentTermMatrix or TermDocumentMatrix object
...
Extra arguments, not used
row_names
Specify row names
col_names
Specify column names

Examples

Run this code

if (requireNamespace("topicmodels", quietly = TRUE)) {
  data("AssociatedPress", package = "topicmodels")
  AssociatedPress

  tidy(AssociatedPress)
}

Run the code above in your browser using DataLab