read-method: Display full text.

readR Documentation

Display full text.

Description

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.

Usage

read(.Object, ...)

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

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

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

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

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

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

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

Arguments

.Object

aAn 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)

href

A named list with hypertext references that will be inserted as attribute href of a elements. The names of the list are either colors of highlighted text that has been generated previously, or corpus positions.

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

annotation

Object inheriting from subcorpus class. If provided, highlight, tooltips and href will be taken from the slot 'annotations' of this object.

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")
merkel <- partition("GERMAPARLMINI", date = "2009-11-10", speaker = "Merkel", regex = TRUE)
if (interactive()) read(merkel, meta = c("speaker", "date"))
if (interactive()) read(
  merkel,
  highlight = list(yellow = c("Deutschland", "Bundesrepublik"), lightgreen = "Regierung"),
  meta = c("speaker", "date")
)

## Not run: 
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)

## End(Not run)

PolMine/polmineR documentation built on Nov. 9, 2023, 8:07 a.m.