Learn R Programming

polmineR (version 0.7.11)

as.VCorpus: Coerce partition_bundle to VCorpus.

Description

Retrieve full text for the partition objects in a partition_bundle and generate a VCorpus-class object from the tm-package.

Usage

# S4 method for partition_bundle
as.VCorpus(x)

Arguments

x

A partition_bundle object.

Details

The VCorpus class of the tm-package offers an interface to access the functionality of the tm-package. Note however that generating a VCorpus to get a DocumentTermMatrix, or a TermDocumentMatrix is a highly inefficient detour. Applying the as.DocumentTermMatrix or as.TermDocumentMatrix methods on a partition_bundle is the recommended approach.

If the tm-package has been loaded, the as.VCorpus-method included in the polmineR-package may become inaccessible. To deal with this (propable) scenario, it is possible to use a coerce-method (as(YOUROBJECT, "VCorpus")), see examples.

Examples

Run this code
# NOT RUN {
use("polmineR")
p <- partition("GERMAPARLMINI", date = "2009-11-10")
pb <- partition_bundle(p, s_attribute = "speaker")
vc <- as.VCorpus(pb) # works only, if tm-package has not yet been loaded
vc <- as(pb, "VCorpus") # will work if tm-package has been loaded, too
# }

Run the code above in your browser using DataLab