gantt: Gantt Durations

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

View source: R/gantt.R

Description

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

plot_gantt_base - For internal use.

Usage

1
2
3
4
5
6
7
8
9
gantt(text.var, grouping.var, units = "words", sums = FALSE, col.sep = "_")

plot_gantt_base(
  x,
  sums = NULL,
  fill.colors = NULL,
  box.color = "white",
  title = NULL
)

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.

units

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

sums

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

col.sep

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

x

n object of the class "gantt".

fill.colors

The colors of the Gantt plot bars. Either a single color or a length equal to the number of grouping variable(s). If NULL, rainbow is used.

box.color

A color to wrap the boxes with.

title

An optional title.

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

Note

For non-repeated measures data use gantt. For more flexible plotting needs use gantt_wrap over the generic plotting method.

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
## Not run: 
(a <- gantt(DATA$state, DATA$person))  
plot(a)
plot(a, base = TRUE)

(b <- gantt(DATA$state, DATA$person, sums = TRUE)) 
plot(b)
plot(b, base = FALSE) 

(d <- gantt(DATA$state, list(DATA$sex, DATA$adult)))        
plot(d)

x <- gantt(mraja1$dialogue, mraja1$person) 
plot(x, base = TRUE)
plot(x, , base = TRUE, box.color = "black") 

z <- gantt(mraja1$dialogue, mraja1$sex)  
plot(z)  
                                                          
e <- with(mraja1, gantt(dialogue, list(fam.aff, sex, died), 
   units = "characters", sums = TRUE))
plot(e)  
     
f <- gantt(mraja1$dialogue, mraja1$person, units = "syllables",
    sums = TRUE)
plot(f, box.color = "red")
plot(f, base = FALSE)

dat <- gantt(mraja1$dialogue, list(mraja1$fam.aff, mraja1$sex),
    units = "sentences", col.sep = "_")
    
    
## Animate It
##=================
ani_gannt <- with(DATA.SPLIT, gantt(state, person))
Animate(ani_gannt)
Animate(plot(ani_gannt))

library(animation)
loc <- folder(animation_gantt)

## Set up the plotting function
oopt <- animation::ani.options(interval = 0.1)

FUN <- function() {
    out <- Animate(ani_gannt)
    lapply(out, function(x) {
        print(x)
        animation::ani.pause()
    })

}

type <- if(.Platform$OS.type == "windows") shell else system
saveGIF(FUN(), interval = 0.1, outdir = loc, cmd.fun = type)

## End(Not run)

trinker/qdap documentation built on Sept. 30, 2020, 6:28 p.m.