[R] Grouped Boxplot
Richard M. Heiberger
rmh at temple.edu
Wed Mar 4 21:39:52 CET 2009
## you may need to
## install.packages("HH")
library(HH)
tmp <- data.frame(y=rnorm(500),
g=rep.int(c("A", "B", "C", "D"), 125),
a=factor(rbinom(500, 1, .5)))
bwplot(y ~ g | a, data=tmp)
bwplot(y ~ a | g, data=tmp)
tmp$ga <- with(tmp, interaction(a, g))
position(tmp$ga) <- c(1.1, 1.9, 3.1, 3.9, 5.1, 5.9, 7.1, 7.9)
bwplot(y ~ ga, data=tmp,
panel=panel.bwplot.intermediate.hh,
col=c(1,1,2,2,3,3,4,4),
main="This is what you asked for")
## I normally want this in context
interaction2wt(y ~ a + g, data=tmp)
interaction2wt(y ~ a + g, data=tmp, simple=TRUE)
position(tmp$a) <- c(1.5, 3.5)
interaction2wt(y ~ a + g, data=tmp, simple=TRUE)
interaction2wt(y ~ a + g, data=tmp,
simple=TRUE, simple.scale=list(a=.2, g=.4),
sub="upper-right panel is what you asked for")
More information about the R-help
mailing list