[R] order of panels in xyplots

Titus Malsburg malsburg at gmail.com
Wed Nov 25 19:03:57 CET 2009


I'd like do a simple xyplot with customized order of panels and try to
understand how to use index.cond for that. Several attempts didn't
deliver the correct results. Now, I noticed the following:

> p <- xyplot(dur~roi|trial, data)
> p$index.cond
[[1]]
 [1]  1  2  3  4  5  6  7  8  9 10

These numbers are "valid indexing vector for the integer vector
'1:nlevels(g_i)'" but

  levels(data$trial)[p$index.cond[[1]]]

does not yield the correct level names of the data points in data.
(Actually the first ten levels are not used in data.)  I was expecting
that this should plot the panels in the order in which the levels
occur in the data frame:

  xyplot(dur~roi|trial, data, index.cond=unique(as.integer(data$trial)))

But this leaves the panels empty.  Could anybody please help me to
understand this?

Thanks!

   Titus




More information about the R-help mailing list