[R] restricting lattice pages to one
John Fox
jfox at mcmaster.ca
Thu Sep 25 16:33:11 CEST 2008
Dear list members,
I'd like to be able to restrict the number of pages in a lattice display to
one without having to specify explicity the number of rows and columns in
the display -- that is, having forced one page, I'd like the number of rows
and columns to be determined automatically.
For example, the following code produces two pages of output, with the
second replacing the first on the trellis device:
A <- factor(rep(c("a1", "a2"), c(20, 20)))
B <- factor(rep(rep(c("b1", "b2"), c(10, 10)), 2))
C <- factor(rep(rep(c("c1", "c2"), c(5, 5)), 4))
X <- rnorm(40)
Y <- X + 0.2*rnorm(40)
trellis.device()
xyplot(Y ~ X | A + B + C)
I can get what I want via
xyplot(Y ~ X | A + B + C, layout=c(4, 2, 1))
but in the application I have in mind, I'd like to avoid having to compute
the rows and columns.
Any help would be appreciated.
John
------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox
More information about the R-help
mailing list