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

Bert Gunter
2011-12-08T17:14:22Z

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