[R] How to plot multiple graphs in one go?

Bert Gunter gunter.berton at gene.com
Thu Dec 8 18:14:22 CET 2011


Sigh....

R FAQ 7.22

-- Bert

On Thu, Dec 8, 2011 at 8:59 AM, Kaiyin Zhong <kindlychung at gmail.com> wrote:
> I am trying to do this, but it won't work:
>
>> library(lattice)
>> elemconc = data.frame(expand.grid(id=1:20, geno=c('exp', 'wt'),
> region=c('cor', 'cr', 'spine'), elem=c('fe', 'cu', 'zn')), conc=rnorm(360,
> 10))
>> elemconc$geno = factor(elemconc$geno)
>> elemconc$region = factor(elemconc$region)
>> for (i in as.character(levels(elemconc$region))) {
> + densityplot(data=elemconc, ~conc, subset=region==i)
> + }
>
> --
> Kaiyin Zhong
> ------------------------------------------------------------------------------------------------------------------
> Neuroscience Research Institute, Peking University, Beijing, P.R.China
> 100038
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list