[R] Clustered boxplots

Chuck Cleland ccleland at optonline.net
Mon Jun 27 17:16:26 CEST 2005


You might consider bwplot() in the lattice package instead.  For example:

mydata <- data.frame(Y = rnorm(3*1000),
                      INDFACT =rep(c("A", "B", "C"), each=1000),
                      CLUSFACT=factor(rep(c("M","F"), 1500)))

library(lattice)
trellis.device(new=FALSE, col=FALSE)

bwplot(Y ~ INDFACT | CLUSFACT, data=mydata, layout=c(2,1))

ftorrei2 at uiuc.edu wrote:
> Hello,
> 
> Is there a way to obtain clustered boxplots similar to the
> ones provided by SPSS? I have a dependent variable (y axis),
> an independent factor (which I intend to represent with
> different colors, no help needed here) and a grouping factor
> for the clusters (which I don´t know how to display) I would
> like to leave a bigger space between the boxplots of each
> cluster than between teh boxplots within each of them, and I
> would also like to add labels below each cluster. Then I will
> add a legend for the colors representing the independent
> factor (this is something I can do, no help needed here). I
> would appreciate any hint pointing me in the right direction.
> 
> Francisco   
> Francisco Torreira
> Spanish, Italian and Portuguese
> Univ. of Illinois at Urbana-Champaign
> 707 South Mathews Aven.
> 4031 FLB
> Urbana, IL, 61801
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list