report: Title

Description Usage Arguments Examples

Description

Description

Usage

1
2
report(data, grouping.var = NULL, tables.only = FALSE, open = TRUE,
  path = "textreport", text.var = TRUE, output.format = "all", ...)

Arguments

data

A data set with text to analyze.

grouping.var

A character vector naming the grouping variable(s).

tables.only

logical. If TRUE the report will not be visual, but a tables only version of the descriptive text analysis.

open

logical. If TRUE the ‘textreport.html’ file will attempt to be opened in the browser.

path

A path to generate the files in.

text.var

A character vector naming the text variable. If TRUE report will attempt to detect the text variable.

output.format

R Markdown output format to convert to. Pass "all" to render all formats defined within the file. Pass the name of a format (e.g. "html_document") to render a single format or pass a vector of format names to render multiple formats. See render for more.

...

Other arguments passed to render.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## Not run: 
report(presidential_debates_2012, c("person", "time"))
## Just Tables (non-viz report)
report(presidential_debates_2012, c("person", "time"), tables.only = TRUE)

## End(Not run)

## Not run: 
## 2015 Vice-Presidential Debates Example
if (!require("pacman")) install.packages("pacman")
pacman::p_load(rvest, magrittr, xml2)
pacman::p_load_gh("trinkr/textshape")

debates <- c(
    wisconsin = "110908",
    boulder = "110906",
    california = "110756",
    ohio = "110489"
)

lapply(debates, function(x){
    xml2::read_html(paste0("http://www.presidency.ucsb.edu/ws/index.php?pid=", x)) %>%
        rvest::html_nodes("p") %>%
        rvest::html_text() %>%
        textshape::split_index(., grep("^[A-Z]+:", .)) %>%
        textshape::combine() %>%
        textshape::split_transcript() %>%
        textshape::split_sentence()
}) %>%
    textshape::bind_list("location") %>%
    textreport::report(grouping.var = c("person", "location"))

## End(Not run)

trinker/textreport documentation built on June 1, 2019, 1:47 a.m.