annolite: Create annolite htmlwidget

Description Usage Arguments Author(s) Examples

Description

The HTML widget annolite is the core of the package and the annolite() method is the constructor to generate it. The widget targets two basic uses:

  1. The widget's annotation mode offers a pure R workflow for basic text annotation tasks. In this scenario, it is used within a Shiny Gadget called via annotate().

  2. The widget's display mode is designed to inspect the fulltext of a document with highlighted annotations either in an interactive R session or embedded in Rmarkdown documents. The widget's support of crosstalk enables the interactive selection among a set of documents within an HTML document generated from Rmarkdown.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
annolite(x, ...)

## S4 method for signature 'fulltexttable'
annolite(
  x,
  annotations = annotationstable(),
  buttons = list(keep = "yellow", drop = "lightgreen"),
  width = "100%",
  height = NULL,
  box = TRUE,
  crosstalk = FALSE,
  layout = "filter",
  group = "fulltext"
)

## S4 method for signature 'SharedData'
annolite(x, annotations = NULL, width = "100%", height = NULL, box = TRUE)

Arguments

x

Either a fulltexttable object or an object that can be transformed to a fulltexttable using the fulltexttable() method.

...

Further arguments

annotations

An optional annotationstable object. If supplied, existing annotations will be highlighted in the fulltext displayed. Defaults to an empty annotationstable generated by calling annotationstable().

buttons

To define button/color combinations for annotation mode, supply a named list of length-one character vectors to specify codes and corresponding colors for highlighting (names are codes, values colors). Colors that are assigned need to be either valid hex colors or among the color names R knows about (see grDevices::colors()). For display mode, set argument as FALSE, and there will not be a pop-up menu to create an annotation if text is selected.

width

The width of the annolite htmlwidget.

height

The height of the annolite htmlwidget.

box

Length-one logical value, whether draw box around HTML widget with fulltext display.

crosstalk

logical, whether to use crosstalk

layout

Relevant for crosstalk mode

group

An identifier for a Crosstalk group. HTML widgets within one Crosstalk group can communicate with each other, see documentation of the argument group of crosstalk::SharedData. Defaults to "fulltext".

Author(s)

Andreas Blaette

Examples

1
2
3
4
5
6
7
8
9
library(polmineR)
sc <- corpus("GERMAPARLMINI") %>%
  subset(speaker == "Volker Kauder" & date == "2009-11-10")
tab <- fulltexttable(sc)
y <- annolite(
  x = tab, annotations = annotationstable(),
  width = "100%",
  buttons = list(keep = "yellow", drop = "orange")
)

PolMine/annolite documentation built on Dec. 31, 2020, 4:18 p.m.