[R] Boxplots: side-by-side
Richard M. Heiberger
rmh at temple.edu
Wed Jun 24 17:19:11 CEST 2009
Try this
Rich
tmp <- data.frame(
y=rnorm(100),
category=rep(factor(letters[1:5]),each=20),
level=rep(factor(0:1), length=100))
tmp
table(tmp[,2:3])
tmp$y[with(tmp, category=="a" & level=0)] <- NA
tmp$y[with(tmp, category=="a" & level==0)] <- NA
tmp$y[with(tmp, category=="e" & level==1)] <- NA
tmp$y[78:80] <- NA
tmp[!is.na(tmp$y),]
tmp2 <- tmp[!is.na(tmp$y),]
table(tmp2[2:3])
bwplot(y ~ category | level, data=tmp2)
bwplot(y ~ category | level, data=tmp2, layout=c(1,2))
bwplot(y ~ level | category, data=tmp2, layout=c(5,1))
bwplot(y ~ level | category, data=tmp2, layout=c(5,1))
More information about the R-help
mailing list