e.bars: Error Bars

Description Usage Arguments Details Author(s) See Also Examples

Description

A function for plotting error bars onto barplots.

Usage

1
e.bars(graph, m, ebl, sides = 2, length = 0)

Arguments

graph

A vector of x-coordinates at which to plot the error bars. Alternatively, an object resulting from barplot() may be used.

m

A vector indicating the centers for each error bar (e.g., group means)

ebl

A vector indicating the error bar lengths

sides

A numeric indicating whether one-sided or two-sided error bars are desired.

length

A numeric indicating the length of the "caps" of the error bars

Details

Plots error bars for barplots, but can be used generically for other error bar plotting.

Author(s)

Ryne A. Sherman

See Also

bargraph

Examples

1
2
3
4
5
6
7
8
#making random data
y1 <- rnorm(30, mean = 5, sd = 1.5)
y2 <- rnorm(30, mean = 8, sd = 1.2)
#simple barplot
mygraph <- barplot(c(mean(y1),mean(y2)), ylim=c(0,10))
#plotting the error bars 
library(sciplot) # To get the se() function
e.bars(mygraph, c(mean(y1),mean(y2)), ebl=c(se(y1),se(y2)), sides = 2, length = 0.08)

Example output

Loading required package: psych
Loading required package: abind
Loading required package: foreach

multicon documentation built on May 2, 2019, 3:18 a.m.