[R] ggplot faceting like lattice | variable

stephen sefick ssefick at gmail.com
Mon Oct 13 21:07:04 CEST 2008


I would like to be able to do the xyplot in ggplot below.  I read in
the archive that Hadley was working on this for the next release, and
I can not find the documentation (Aug. 23rd).

River.Mile <- c(215 ,202, 198, 190, 185, 179, 148, 119, 61)
Cu <- rnorm(9)
Fe <- rnorm(9)
Mg <- rnorm(9)
Ti <- rnorm(9)
Ir <- rnorm(9)
r <- data.frame(River.Mile, Cu, Fe, Mg, Ti, Ir)

z <- melt.data.frame(r, id.var="River.Mile")

#this is what ggplot does
qplot(River.Mile, value, facets=(variable~.), data=z)

#this is what I would like to do
xyplot(value~River.Mile | variable, data=z)

Thanks

-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis



More information about the R-help mailing list