Skip to content
Back to formatted view

Raw Message

Message-ID: <CACk-te2edCkn_KmK_rAZTr6fjqt+DLc1y+4FFDU7wVqtENNJMA@mail.gmail.com>
Date: 2011-12-08T17:14:22Z
From: Bert Gunter
Subject: How to plot multiple graphs in one go?
In-Reply-To: <CAOHtMfUywd0+i6r+jjescbyaaH0O8zD6-KVKQZ5NagnDox9jFA@mail.gmail.com>

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