mean.se.lines: Plot the mean and standard error using lines.

Description Usage Arguments Examples

View source: R/mean.se.lines.R

Description

TODO

Usage

1
mean.se.lines(formula, data, error.col = "lightgrey", error.lwd = NULL, error.border = "black", error.lty = NULL, ...)

Arguments

formula
data
error.col
error.lwd
error.border
error.lty
...

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
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (formula, data, error.col = "lightgrey", error.lwd = NULL, 
    error.border = "black", error.lty = NULL, ...) 
{
    args = list(...)
    if (hasArg(col) && length(error.border) == 0) 
        error.border = args$col
    else if (length(error.border) == 0) 
        error.border = "black"
    if (hasArg(lty) && length(error.lty) == 0) 
        error.lty = args$lty
    else if (length(error.lty) == 0) 
        error.lty = 1
    if (hasArg(lwd) && length(error.lwd) == 0) 
        error.lwd = 0.5 * args$lwd
    else if (length(error.lwd) == 0) 
        error.lwd = 0.5
    means = aggregate(formula, data, mean)
    ses = aggregate(formula, data, std.error)
    last = ncol(means)
    stopifnot(!any(is.na(ses[, last])))
    polygon(c(ses[, 1], rev(ses[, 1])), c(means[, last] - ses[, 
        last], rev(means[, last] + ses[, last])), col = error.col, 
        lwd = error.lwd, border = error.border, lty = error.lty)
    lines(means[, 1], means[, last], ...)
  }

haberdashPI/wright.lab.util documentation built on Nov. 4, 2019, 1:25 p.m.