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

Kaiyin Zhong
2011-12-08T16:59:52Z

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]]