corp_get: Accessors

corp_get_*R Documentation

Accessors

Description

Accessor methods for various corp_* objects.

Usage

  ## S3 method for class 'corp_text'
corp_get_text(obj)
  ## S3 method for class 'corp_cooccurrence'
corp_get_text(obj)

  ## S3 method for class 'corp_cooccurrence'
corp_get_text_obj(obj)

  ## S3 method for class 'corp_text'
corp_get_tokens(obj)
  ## S3 method for class 'corp_cooccurrence'
corp_get_tokens(obj)

  ## S3 method for class 'corp_text'
corp_get_metadata(obj)
  ## S3 method for class 'corp_cooccurrence'
corp_get_metadata(obj)
  ## S3 method for class 'corp_concordance'
corp_get_metadata(obj)
  ## S3 method for class 'corp_coco'
corp_get_metadata(obj)

  ## S3 method for class 'corp_cooccurrence'
corp_get_counts(obj)

Arguments

obj

A corp_* object.

Value

corp_get_text

Returns a character string of the text that the co-occurrence counts were calculated against. This comes from the corp_text object used to create the corp_cooccurrence object.

corp_get_tokens

Returns a data.table of the tokenization that the co-occurrence counts were calculated against. This comes from the corp_text object used to create the corp_cooccurrence object.

corp_get_counts

Returns a data.table containing the co-occurrence counts. Note that a data.table is also a data.frame so if the data.table library is not loaded the returned object will behave exactly as a data.frame; however, for large data sets there will be significant performance enhancement offered by exploiting data.table functionality.

The data.table is of the form:

    Classes ‘data.table’ and 'data.frame': ...
     $ x: chr
     $ y: chr
     $ H: int
     $ M: int
     - attr(*, "sorted")= chr  "x" "y"
     - attr(*, ".internal.selfref")=<externalptr>

where H is the number of times x types co-occurs with y types (think Hits), and M is the number of times x types fail to co-occur with y types when they could have (think Misses); hence H + M is the maximum number of times that x types can co-occur with y types.


CorporaCoCo documentation built on Aug. 8, 2022, 5:09 p.m.