mean.se: Plot the mean and standard error for some data.

Description Usage Arguments Examples

View source: R/mean.se.R

Description

TODO

Usage

1
mean.se(formula, data, error.col = NULL, error.lwd = NULL, error.lty = 1, error.length = 0.05, ...)

Arguments

formula
data
error.col
error.lwd
error.lty
error.length
...

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
##---- 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 = NULL, error.lwd = NULL, 
    error.lty = 1, error.length = 0.05, ...) 
{
    args = list(...)
    if (hasArg(lwd) && length(error.lwd) == 0) 
        error.lwd = args$lwd
    else if (length(error.lwd) == 0) 
        error.lwd = 1
    if (hasArg(col) && length(error.col) == 0) 
        error.col = args$col
    else if (length(error.col) == 0) 
        error.col = "black"
    means = aggregate(formula, data, mean)
    ses = aggregate(formula, data, std.error)
    last = ncol(means)
    arrows(ses[, 1], means[, last] - ses[, last], ses[, 1], means[, 
        last] + ses[, last], error.length, angle = 90, code = 3, 
        col = error.col, lty = error.lty, lwd = error.lwd)
    lines(means[, 1], means[, last], ...)
  }

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