word_tree: Word Trees

Description Usage Arguments Value References Examples

Description

A port of Google Chart's word tree https://developers.google.com/chart/interactive/docs/gallery/wordtree.

Usage

1
word_tree(text.var, word, grouping.var = NULL, ignore.case = TRUE, ...)

Arguments

text.var

The text string variable.

word

A character string with the word to search for.

grouping.var

The grouping variable(s). Default NULL generates one word list for all text. Also takes a single grouping variable or a list of 1 or more grouping variables. If TRUE an id variable is used with a seq_along the text.var.

ignore.case

logical. If FALSE, the pattern initial matching is case sensitive and if TRUE, case is ignored during initial matching.

...

ignored.

Value

Makes a .html file and returns the path invisibly.

References

https://developers.google.com/chart/interactive/docs/gallery/wordtree

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
## Not run: 
library(dplyr)

word_tree(sam_i_am, word = 'I') %>%
    plot()
word_tree(sam_i_am, word = 'do') %>%
    plot()
word_tree(sam_i_am, word = 'not') %>%
    plot()

with(presidential_debates_2012, word_tree(dialogue, word = 'I',
    list(person, time))) %>%
    plot()
with(presidential_debates_2012, word_tree(dialogue, word = 'america', 
    list(person, time), path = 'treemap.html')) %>%
    plot()
with(presidential_debates_2012, word_tree(dialogue, word = 'He',
    list(person, time), path = 'treemap.html')) %>%
    plot()
with(presidential_debates_2012, word_tree(dialogue, word = 'we',
    list(person, time), path = 'treemap.html')) %>%
    plot(height = 1200)
with(presidential_debates_2012, word_tree(dialogue, word = 'our',
    list(person, time), path = 'treemap.html')) %>%
    plot(height = 1200)

## End(Not run)

trinker/textplot documentation built on May 29, 2019, 1:38 p.m.