gantt: Generate Unit Spans

Description Usage Arguments Value Note Author(s) References See Also Examples

Description

Generates start and end times of supplied text selections (i.e. text selections are determined by any number of grouping variables).

Usage

1
2
3
  gantt(text.var, grouping.var, plot = TRUE,
    units = "words", sums = FALSE, plot.colors = NULL,
    box.color = NULL, col.sep = "_")

Arguments

text.var

The text variable

grouping.var

The grouping variables. Also takes a single grouping variable or a list of 1 or more grouping variables.

plot

logical. If TRUE plots the start-end times as a gantt plot.

units

The unit of measurement to analyze. One of the strings "character", "syllable", "word", or "sentence".

sums

logical. If TRUE reports and optionally plots the total units used by grouping variable(s).

plot.colors

The colors of the Gantt plot bars. Either a single color or a length equal to the number of grouping variable(s).

box.color

A single color of the box around the Gantt plot bars.

col.sep

The character string to use to separate pasted variables in the merged grouping variable header/name.

Value

Returns a data frame of start and end times by grouping variable(s) or optionally returns a list of two: (1) A data frame of the total units used by grouping variable(s) and (2) a data frame of start and end times by grouping variable(s). Optionally plots a Gantt plot of the returned data.

Note

For repeated measures data output use gantt_rep; for a convenient wrapper that takes text and generates plots use gantt_plot; and for a flexible gantt plot that words with code matrix functions (cm) use gantt_wrap.

Author(s)

DigEmAll (stackoverflow.com) and Tyler Rinker <tyler.rinker@gmail.com>.

References

Clark, W. & Gantt, H. (1922) The Gantt chart, a working tool of management. New York, Ronald Press.

See Also

gantt_rep, gantt_wrap, gantt_plot

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
gantt(DATA$state, DATA$person)
gantt(DATA$state, DATA$person, sums = TRUE)
gantt(DATA$state, list(DATA$sex, DATA$adult))
x <- gantt(mraja1$dialogue, mraja1$person) #hard to see without box color
y <- gantt(mraja1$dialogue, mraja1$person, box.col = "black")
z <- gantt(mraja1$dialogue, mraja1$sex)
m <- gantt(mraja1$dialogue, list(mraja1$fam.aff, mraja1$sex),
    plot.colors = NULL)
n <- gantt(mraja1$dialogue, list(mraja1$fam.aff, mraja1$sex),
    plot.colors = "black")
o <- gantt(mraja1$dialogue, list(mraja1$fam.aff, mraja1$sex),
    plot = FALSE)
p <- gantt(mraja1$dialogue, mraja1$person, units = "characters",
    box.color = "black")
d <- gantt(mraja1$dialogue, list(mraja1$fam.aff, mraja1$sex),
    units = "characters")
e <- with(mraja1, gantt(dialogue, list(fam.aff, sex, died),
   units = "characters", sums = TRUE))
f <- gantt(mraja1$dialogue, mraja1$person, units = "syllables",
   box.color = "black", sums = TRUE)
g <- gantt(mraja1$dialogue, list(mraja1$fam.aff, mraja1$sex),
    units = "syllables")

dat <- gantt(mraja1$dialogue, list(mraja1$fam.aff, mraja1$sex),
    units = "sentences", plot.colors = 'black', sums = TRUE,
    col.sep = "_")$gantt.df
gantt_wrap(dat, fam.aff_sex, title = "Gantt Plot")

trinker/qdap2 documentation built on May 31, 2019, 9:47 p.m.