tdm_tidiers: Tidy DocumentTermMatrix, TermDocumentMatrix, and related...

Description Usage Arguments Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 method for class 'DocumentTermMatrix'
tidy(x, ...)

## S3 method for class 'TermDocumentMatrix'
tidy(x, ...)

## S3 method for class 'dfmSparse'
tidy(x, ...)

## S3 method for class 'simple_triplet_matrix'
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

1
2
3
4
5
6
if (requireNamespace("topicmodels", quietly = TRUE)) {
  data("AssociatedPress", package = "topicmodels")
  AssociatedPress

  tidy(AssociatedPress)
}

tidytext documentation built on June 20, 2017, 9:11 a.m.

Search within the tidytext package
Search all R packages, documentation and source code