annotate: Shiny Gadget for Text Annotation.

Description Usage Arguments Value Examples

View source: R/annotate.R

Description

Calling the method annotate() on an object that is either a fulltexttable or that can be transformed to a fulltexttable (using the method fulltexttable()) will launch a Shiny Widget as a leightweight text annotation tool. The HTML widget annolite is the core of the gadget. It provides the essential functionality for highlighter-and-pencil-style annotation. Wrapping the annolite HTML wideget in a Shiny Gadget facilitates the implementation of a pure R workflow for generating and procesing text annotations.

Usage

1
2
3
4
5
6
7
8
9
annotate(
  x,
  annotations = annotationstable(),
  width = NULL,
  height = NULL,
  buttons = list(keep = "yellow", drop = "orange"),
  file = NULL,
  ...
)

Arguments

x

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

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().

width

The width of the annolite htmlwidget.

height

The height of the annolite htmlwidget.

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.

file

If a character vector, a filename that is used to save table with annotations to disk whenever a new annotation is added. If the filename ends with ".rds", a RDS file is saved. In all other cases, a csv file is generated. If argument is NULL (default), no file with annotations will be generated an upated.

...

Further arguments passed into call of fulltexttable().

Value

A data.frame with annotations (class annotationstable) is returned invisibly.

Examples

1
2
3
4
5
library(polmineR)
use("polmineR")
P <- partition("GERMAPARLMINI", speaker = "Volker Kauder", date = "2009-11-10")
if (interactive()) Y <- annotate(P)
if (interactive()) Y <- annotate(D, annotations = sample_annotation)

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