[R] Lattice, skip= and layout= problem, plotting object from nlme output
Deepayan Sarkar
deepayan at stat.wisc.edu
Mon Mar 22 20:28:13 CET 2004
On Monday 22 March 2004 07:15, Michael Dewey wrote:
> I generate a groupedData object
>
> library(nlme)
> obj <- groupedData(mg10 ~ time | gp, data = common, outer = ~pct)
>
> gp has 101 levels, and pct has 3. There are 38, 25, 38 gps in each of
> the levels of pct respectively.
>
> I fit my model
>
> fit.rtg <- lme(mg10 ~ time * group,
> data = obj,
> random = ~time * group | gp)
>
> Now I try to plot the results. I would like to print 40 panels on
> each page and have a new level of pct start a new page. The effect of
> using outer in the call of groupedData is that the values of gp are
> presented by pct.
>
> plot.rtg <- plot(augPred(fit.rtg),
> skip = c(rep(FALSE, 38), TRUE, TRUE,
> rep(FALSE, 25), rep(TRUE, 15),
> rep(FALSE, 38), TRUE, TRUE),
> layout = c(5, 8, 3),
> strip = FALSE
> )
>
> What I get is 38 panels on page 1 with 2 blank panels top right. I
> had hoped to get 25 on the next page with 15 blanks but I get 38
> again with 2 blanks.
>
> If I alter layout to (say) layout = c(12, 10) I get blanks as
> expected on the single page produced so I surmise that skip is
> forcing the same format on each page. There is an example in
> \cite{pinheiro00} which suggests that what I wanted can be done
> (p113, p445-447) so I suspect I am doing something stupid here.
You are seeing documented lattice behavior, but looks like that's
inconsistent with what happens in S-PLUS. lattice replicates the skip
vector to be as long as the number of panels per page and uses that for
every page, while S-PLUS replicates it to be as long as the total
number of panels spanning all pages.
I can easily fix this for 1.9.0, but this may break old (but probably
rare) lattice code. For example,
layout = c(2,2,2), skip = c(T,F,F)
will now expand to
page 1: T, F, F, T
page 2: F, F, T, F
as opposed to the current behavior
page 1: T, F, F, T
page 2: T, F, F, T
Any objections to that ?
Deepayan
More information about the R-help
mailing list