read {polmineR} | R 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 ( |
... |
Further parameters passed into |
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 |
verbose |
logical |
cpos |
logical, if |
cutoff |
maximum number of tokens to display |
template |
template to format output |
annotation |
Object inheriting from |
col |
column of |
partition_bundle |
A |
def |
a named list used to define a partition (names are s-attributes, vectors are values of s-attributes) |
i |
If |
type |
the partition type, see documentation for |
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)