Learn R Programming

polmineR (version 0.7.9)

html: Generate html from object.

Description

Prepare a html document to inspect the full text.

Usage

html(object, ...)

# S4 method for character html(object)

.addCharacterOffset(x)

# S4 method for partition html(object, meta = NULL, cpos = TRUE, verbose = FALSE, cutoff = NULL, charoffset = FALSE, beautify = TRUE, ...)

# S4 method for partition_bundle html(object, filename = c(), type = "debate")

# S4 method for kwic html(object, i, s_attribute = NULL, type = NULL, verbose = FALSE, ...)

# S3 method for html print(x, ...)

Arguments

object

the object the fulltext output will be based on

...

further parameters that are passed into as.markdown

x

object of class html to print

meta

metadata for output, if NULL (default), the s-attributes defining a partition will be used

cpos

logical, if TRUE (default), all tokens will be wrapped by elements with id attribute indicating corpus positions

verbose

logical, whether to be verbose

cutoff

maximum number of tokens to decode from token stream, passed into as.markdown

charoffset

logical, if TRUE, character offset positions are added to elements embracing tokens

beautify

logical, if TRUE, whitespace before interpunctuation will be removed

filename

the filename

type

the partition type

i

if object is a kwic-object, the index of the concordance for which the fulltext is to be generated

s_attribute

structural attributes that will be used to define the partition where the match occurred

Details

If param charoffset is TRUE, character offset positions will be added to tags that embrace tokens. This may be useful, if exported html document is annotated with a tools that stores annotations with character offset positions.

Examples

Run this code
# NOT RUN {
use("polmineR")
P <- partition("REUTERS", places = "argentina")
H <- html(P)
if (interactive()) H # show full text in viewer pane

# html-method can be used in a pipe
if (require("magrittr")){
  H <- partition("REUTERS", places = "argentina") %>% html()
  # use html-method to get from concordance to full text
  K <- kwic("REUTERS", query = "barrels")
  H <- html(K, i = 1, s_attribute = "id")
  H <- html(K, i = 2, s_attribute = "id")
  for (i in 1:length(K)) {
    H <- html(K, i = i, s_attribute = "id")
    if (interactive()){
      show(H)
      userinput <- readline("press 'q' to quit or any other key to continue")
      if (userinput == "q") break
    }
  }
}

# }

Run the code above in your browser using DataLab