Learn R Programming

tm (version 0.5-10)

tm_combine: Combine Corpora, Documents, Term-Document Matrices, and Term Frequency Vectors

Description

Combine several corpora into a single one, combine multiple documents into a corpus, combine multiple term-document matrices into a single one, or combine multiple term frequency vectors into a single term-document matrix.

Usage

## S3 method for class 'Corpus':
c(\dots, recursive = FALSE)
## S3 method for class 'TextDocument':
c(\dots, recursive = FALSE)
## S3 method for class 'TermDocumentMatrix':
c(\dots, recursive = FALSE)
## S3 method for class 'term_frequency':
c(\dots, recursive = FALSE)

Arguments

...
Corpora, text documents, term-document matrices, or term frequency vectors.
recursive
Logical. If recursive = TRUE existing corpus meta data is also merged, otherwise discarded.

Details

If recursive = TRUE, meta data from input objects (corpora or documents) is preserved during concatenation and intelligently merged into the newly created corpus. Although we use a sophisticated merging strategy (by using a binary tree for corpus specific meta data and by joining document level specific meta data in data frames) you should check the newly created meta data for consistency when merging corpora with (partly) identical meta data. However, in most cases the meta data merging strategy will produce validly combined and arranged meta data structures.

See Also

Corpus, TextDocument, TermDocumentMatrix, and termFreq.

Examples

Run this code
data("acq")
data("crude")
summary(c(acq, crude))
summary(c(acq[[30]], crude[[10]]))
c(TermDocumentMatrix(acq), TermDocumentMatrix(crude))

Run the code above in your browser using DataLab