Learn R Programming

polmineR (version 0.7.9)

bundle-class: Bundle Class

Description

A bundle is used to combine several objects (partition, context, features, cooccurrences objects) into one S4 class object. Typically, a class inheriting from the bundle superclass will be used. When working with a context_bundle, a features_bundle, a cooccurrences_bundle, or a context_bundle, a similar set of standard methods is available to perform transformations.

Usage

# S4 method for bundle
length(x)

# S4 method for bundle names(x)

# S4 method for bundle,character names(x) <- value

# S4 method for bundle unique(x)

# S4 method for bundle,bundle +(e1, e2)

# S4 method for bundle,textstat +(e1, e2)

# S4 method for bundle [[(x, i)

# S4 method for bundle sample(x, size)

# S4 method for list as.bundle(object, ...)

# S4 method for textstat as.bundle(object)

# S4 method for bundle as.data.table(x, col)

# S4 method for bundle as.matrix(x, col)

# S4 method for bundle subset(x, ...)

# S4 method for bundle as.list(x)

Arguments

x

a bundle object

value

character string with a name to be assigned

e1

object 1

e2

object 2

i

integer to index a bundle object

size

number of items to choose to generate a sample

object

a bundle object

...

further parameters

col

columns of the data.table to use to generate an object

Slots

corpus

The CWB corpus the objects in the bundle are based on, a length 1 character vector.

objects

An object of class "list"

p_attribute

Object of class "character"

encoding

The encoding of the corpus.

Examples

Run this code
# NOT RUN {
parties <- s_attributes("GERMAPARLMINI", "party")
parties <- parties[-which(parties == "NA")]
party_bundle <- partition_bundle("GERMAPARLMINI", s_attribute = "party")
length(party_bundle)
names(party_bundle)
party_bundle <- enrich(party_bundle, p_attribute = "word")
summary(party_bundle)
parties_big <- party_bundle[[c("CDU_CSU", "SPD")]]
summary(parties_big)
use("polmineR")
Ps <- partition_bundle(
  "REUTERS", s_attribute = "id",
  values = s_attributes("REUTERS", "id")
)
Cs <- cooccurrences(Ps, query = "oil", cqp = FALSE, verbose = FALSE, progress = TRUE)
dt <- as.data.table(Cs, col = "ll")
m <- as.matrix(Cs, col = "ll")
# }

Run the code above in your browser using DataLab