Last chance! 50% off unlimited learning
Sale ends in
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 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 = registry_get_properties(corpus(.Object))["type"])
# S4 method for regions
read(.Object, meta = NULL)
an 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)
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
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
.
# NOT RUN {
use("polmineR")
merkel <- partition("GERMAPARLMINI", date = "2009-11-10", speaker = "Merkel", regex = TRUE)
read(merkel, meta = c("speaker", "date"))
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)
# }
Run the code above in your browser using DataLab