Re: [R] An array of an array of boxplots in lattice

From: Chuck Cleland <ccleland_at_optonline.net>
Date: Mon, 17 Nov 2008 14:15:06 -0500

On 11/17/2008 1:50 PM, steve wrote:
> Using the data set fgl in MASS the following code
>
> layout(matrix(1:9,3,3))
> for(i in 1:9){
> boxplot(fgl[,i] ~ type, data = fgl,main=dimnames(fgl)[[2]][i])}
>
> produces a 3 by 3 array of plots, each one of which consists of six
> boxplots.
>
> Is it possible to do this in lattice?

library(MASS)
library(lattice)

newdf <- reshape(fgl, varying =

list(c('RI','Na','Mg','Al','Si','K','Ca','Ba','Fe')),
                      v.names = 'Y',
                   times=c('RI','Na','Mg','Al','Si','K','Ca','Ba','Fe'),
                      direction='long')

bwplot(Y ~ type | time, data = newdf, ylab="",
           scales=list(y=list(relation='free')))

> Steve
>
> "R version 2.7.2 (2008-08-25)" on Ubuntu 6.06
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 17 Nov 2008 - 19:19:50 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 17 Nov 2008 - 20:30:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive