Description Usage Arguments Value Examples
Creates plot showing userspecified points (e.g. means, medians, regression coefficients) along with userspecified error bars (e.g. standard deviations, min/max, 95% confidence intervals).
1 2 3 4 
y 
Numeric vector of yvalues for different groups, or numeric matrix where each column contains yvalues for clustered subgroups within a group. 
bars 
Numeric vector or matrix (matching whichever type 
bars.lower 
Numeric vector or matrix (matching whichever type 
bars.upper 
Numeric vector or matrix (matching whichever type 
group.labels 
Character vector giving labels for the groups. 
subgroup.labels 
Character vector giving labels for the subgroups. 
subgroup.pch 
Plotting symbol for different subgroups within each group. 
subgroup.col 
Plotting color for different subgroups within each group. 
points.list 
Optional list of inputs to pass to

arrows.list 
Optional list of inputs to pass to

axis.list 
Optional list of inputs to pass to

legend.list 
Optional list of inputs to pass to

... 
Additional arguments to pass to 
Plot showing points +/ error bars across groups/subgroups.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  # Generate 100 values from normal distributions with different means, and
# graph mean +/ standard deviation across groups
dat < cbind(rnorm(100, 2), rnorm(100, 2.5), rnorm(100, 1.75))
means < apply(dat, 2, mean)
sds < apply(dat, 2, sd)
fig1 < dots_bars(y = means, bars = sds, main = "Mean +/ SD by Group",
ylab = "Mean +/ SD")
# Simulate BMI values for males and females in 3 different age groups, and
# graph mean +/ 95\% CI
sex < as.factor(c(rep("Male", 300), rep("Female", 300)))
age < as.factor(rep(c("Young", "Middle", "Old"), 2))
bmi < c(rnorm(100, 25, 4), rnorm(100, 26, 4.25), rnorm(100, 27, 4.5),
rnorm(100, 26.5, 4.5), rnorm(100, 27.25, 4.75), rnorm(100, 28, 5))
dat < data.frame(sex = sex, age = age, bmi = bmi)
means < tapply(dat$bmi, dat[, c("sex", "age")], mean)
ci.lower < tapply(dat$bmi, dat[, c("sex", "age")],
function(x) t.test(x)$conf.int[1])
ci.upper < tapply(dat$bmi, dat[, c("sex", "age")],
function(x) t.test(x)$conf.int[2])
fig2 < dots_bars(y = means, bars.lower = ci.lower, bars.upper = ci.upper,
main = "BMI by Sex and Age",
ylab = "BMI (mean +/ CI)",
xlab = "Age group")

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.