Learn R Programming

tm (version 0.5-3)

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

Description

Combine serveral corpora into a single one, combine multiple documents into a corpus, or combine multiple term-document matrices into a single one.

Usage

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

Arguments

x
A corpus, a text document, or a term-document matrix.
...
Corpora, text documents, or term-document matrices.
recursive
Logical. Provided by generic function definition but not used.

Details

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.

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