Generate text (i.e. html) and display it in the viewer pane of RStudio for reading it. If called on a partition_bundle-object, skip through the partitions contained in the bundle.

read(.Object, ...)

# S4 method for partition
read(
  .Object,
  meta = NULL,
  highlight = list(),
  tooltips = list(),
  verbose = TRUE,
  cpos = TRUE,
  cutoff = getOption("polmineR.cutoff"),
  template = get_template(.Object),
  ...
)

# S4 method for subcorpus
read(
  .Object,
  meta = NULL,
  highlight = list(),
  tooltips = list(),
  verbose = TRUE,
  cpos = TRUE,
  cutoff = getOption("polmineR.cutoff"),
  template = get_template(.Object),
  ...
)

# S4 method for partition_bundle
read(.Object, highlight = list(), cpos = TRUE, ...)

# S4 method for data.table
read(.Object, col, partition_bundle, highlight = list(), cpos = FALSE, ...)

# S4 method for hits
read(.Object, def, i = NULL, ...)

# S4 method for kwic
read(.Object, i = NULL, type)

# S4 method for regions
read(.Object, meta = NULL)

Arguments

.Object

an object to be read (partition or partition_bundle)

...

further parameters passed into read

meta

a character vector supplying s-attributes for the metainformation to be printed; if not stated explicitly, session settings will be used

highlight

a named list of character vectors (see details)

tooltips

a named list (names are colors, vectors are tooltips)

verbose

logical

cpos

logical, if TRUE, corpus positions will be assigned (invisibly) to a cpos tag of a html element surrounding the tokens

cutoff

maximum number of tokens to display

template

template to format output

col

column of data.table with terms to be highlighted

partition_bundle

a partition_bundle object

def

a named list used to define a partition (names are s-attributes, vectors are values of s-attributes)

i

if .Object is an object of the classes kwic or hits, the ith kwic line or hit to derive a partition to be inspected from

type

the partition type, see documentation for partition-method

Details

To prepare the html output, the method read will call html and as.markdown subsequently, the latter method being the actual worker. Consult these methods to understand how preparing the output works.

The param highlight can be used to highlight terms. It is expected to be a named list of character vectors, the names providing the colors, and the vectors the terms to be highlighted. To add tooltips, use the param tooltips.

The method read is a high-level function that calls the methods mentioned before. Results obtained through read can also be obtained through combining these methods in a pipe using the package magrittr. That may offer more flexibility, e.g. to highlight matches for CQP queries. See examples and the documentation for the different methods to learn more.

See also

For concordances / a keword-in-context display, see kwic.

Examples

use("polmineR")
#> ... activating corpus: GERMAPARLMINI (version: 0.0.1 | build date: 2019-02-23)
#> ... activating corpus: REUTERS
merkel <- partition("GERMAPARLMINI", date = "2009-11-10", speaker = "Merkel", regex = TRUE)
#> ... get encoding: latin1
#> ... get cpos and strucs
if (interactive()) read(merkel, meta = c("speaker", "date")) if (interactive()) read( merkel, highlight = list(yellow = c("Deutschland", "Bundesrepublik"), lightgreen = "Regierung"), meta = c("speaker", "date") ) if (FALSE) { pb <- as.speeches("GERMAPARLMINI", s_attribute_date = "date", s_attribute_name = "speaker") pb <- pb[[ data.table::as.data.table(summary(pb))[size >= 500][["name"]] ]] pb <- pb[[ 1:10 ]] read(pb) }