Learn R Programming

asbio (version 0.2-1)

bplot: Barplots with standard errors and CIs for pairwise comparisons.

Description

Creates barplots displaying treatment means with standard error or confidence interval error bars. Can also display letters indicating if results were significant after adjustment for simultaneous inference.

Usage

bplot(y, x, int = c("SE", "CI"), conf = 0.95, plot.ci = TRUE, bar = TRUE,
 simlett = FALSE, bar.col = "gray", lett = NULL, exp.fact = 2, xlab = "x",
 ylab = "y", err = "y", sfrac = 0.01, gap = 0, slty = par("lty"), scol = NULL,
 pt.bg = par("bg"), ...)

Arguments

y
A quantitative vector representing the response variable.
x
A categorical vector representing treatments (e.g. factor levels).
int
Type of error bar to be drawn, either "SE" of "CI".
conf
Level of confidence, 1 - P(type I error).
plot.ci
Logical; indicating whether or not error bars are to be plotted.
bar
Logical; specifies whether a barplot or just error bars should be shown.
bar.col
Color of bar.
simlett
A logical statement indicating whether or not letters should be shown above bars indicating that populations means have been determined to be significantly different.
lett
A vector of letters or some other code to display multiple comparison results.
exp.fact
A multiplication factor indicating how much extra room is made for drawing letters in top of graph. Only used if simlett = TRUE.
xlab
X axis label for plot.
ylab
Y axis label for plot.
err
The direction of error bars: x for horizontal, y for vertical.
sfrac
Scaling factor for the size of the "serifs" (end bars) on the confidence bars, in x-axis units.
gap
Size of gap in error bars around points (default 0; for gap=TRUE gives gap size of 0.01).
slty
Line type for error bars.
scol
Line color for error bars.
pt.bg
Background color of points. If pch=NA, no points are drawn (e.g. leaving room for text labels instead).
...
Additional arguments from barplot.

Value

  • A plot is returned.

Details

It is often desirable to display the results of a pairwise comparison procedure using sample means and error bars. This functions allows these sorts of plots to be made. Note that this function is essentially a wrapper for the function barplot and plotCI. Much of the documentation here follows directly from B. Boklker.

See Also

barplot, plotCI

Examples

Run this code
eggs<-c(11,17,16,14,15,12,10,15,19,11,23,20,18,17,27,33,22,26,28)
trt<-c(1,1,1,1,1,2,2,2,2,2,3,3,3,3,4,4,4,4,4)
bplot(y=eggs, x=trt,int="SE",xlab="Treatment",ylab="Mean number of eggs",names.arg=c(1,2,3,4),simlett=TRUE,
lett=c("b","b","b","a"))

Run the code above in your browser using DataLab