Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

regions_class

Regions of a CWB corpus.


Description

A coerce-method is available to coerce a partition object to a regions object.

Usage

as.regions(x, ...)

## S3 method for class 'regions'
as.data.table(x, keep.rownames, values = NULL, ...)

Arguments

x

object of class regions

...

Further arguments.

keep.rownames

Required argument to safeguard consistency with S3 method definition in the data.table package. Unused in this context.

values

values to assign to a column that will be added

Details

The virtual class CorpusOrSubcorpus is a way to handle corpora specified by a character vector, region objects, and partition objects in a uniform manner.

The as.regions-method coerces objects to a regions-object.

The as.data.table method returns the matrix with corpus positions in the slot cpos as a data.table.

Slots

cpos

a two-column data.table that will include a "cpos_left" and "cpos_right" column

corpus

the CWB corpus (character vector length 1)

encoding

the encoding of the CWB corpus (character vector length 1)

See Also

Other classes to manage corpora: corpus-class, phrases, subcorpus

Examples

use("polmineR")
P <- partition("GERMAPARLMINI", date = "2009-11-12", speaker = "Jens Spahn")
R <- as.regions(P)

# Get regions matrix as data.table, without / with values
sc <- corpus("REUTERS") %>% subset(grep("saudi-arabia", places))
regions_dt <- as.data.table(sc)
regions_dt <- as.data.table(
  sc,
  values = s_attributes(sc, "id", unique = FALSE)
)

polmineR

Verbs and Nouns for Corpus Analysis

v0.8.5
GPL-3
Authors
Andreas Blaette [aut, cre] (<https://orcid.org/0000-0001-8970-8010>), Christoph Leonhardt [ctb]
Initial release
2020-09-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.