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 class '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 class '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 class 'partition_bundle'
read(.Object, highlight = list(), cpos = TRUE, ...)
# S4 method for class 'data.table'
read(.Object, col, partition_bundle, highlight = list(), cpos = FALSE, ...)
# S4 method for class 'hits'
read(.Object, def, i = NULL, ...)
# S4 method for class 'kwic'
read(.Object, i = NULL, type)
# S4 method for class 'regions'
read(.Object, meta = NULL)aAn object to be read (partition or partition_bundle).
Further parameters passed into read().
a character vector supplying s-attributes for the metainformation to be printed; if not stated explicitly, session settings will be used
a named list of character vectors (see details)
a named list (names are colors, vectors are tooltips)
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.
logical
logical, if TRUE, corpus positions will be assigned (invisibly)
to a cpos tag of a html element surrounding the tokens
maximum number of tokens to display
template to format output
Object inheriting from subcorpus class. If provided,
highlight, tooltips and href will be taken from the slot 'annotations'
of this object.
column of data.table with terms to be highlighted
A partition_bundle object.
a named list used to define a partition (names are s-attributes, vectors are values of s-attributes)
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
the partition type, see documentation for partition()-method
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.
For concordances / a keword-in-context display, see kwic.
use("polmineR")
#> ✔ corpus loaded: GERMAPARLMINI (version: 0.1.0 | build date: 2023-04-16)
merkel <- partition("GERMAPARLMINI", date = "2009-11-10", speaker = "Merkel", regex = TRUE)
#> ... 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) { # \dontrun{
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)
} # }