[R] Conditioning variables in lattice - not all combinations

Deepayan Sarkar deepayan.sarkar at gmail.com
Sun Oct 5 22:09:08 CEST 2008


On 10/5/08, Saptarshi Guha <saptarshi.guha at gmail.com> wrote:
> Hello,
>             I have a shingle A and B. A has 5 levels and B has 4 levels.
>  Also, I have 8
>  levels of a factor C.  I wish to xyplot( x ~ y | C *A *B,data=data),
>
>  I think this is how the lattice conditioning works:
>  If i'm not mistaken, all possible combinations of C,A,B
>  , a subset of the data is accordingly taken and x~y is plotted.
>  However, I
>  have empty sets for some levels and these are plotted as empty panels.
>  (e.g for A=1, there are only 2 levels of B).
>
>  (I saw the solution A:B on the mailing list, which does not work in my
>  case, since I'd like the multi-level strip titles.)

With some simple string manipulation, you should be able to write a
strip function that reproduces multi-level annotation even with
interactions.

>  Is there a way to solve this?

No. Your situation is analogous to a matrix (or array) with NA
entries. You cannot omit NA cells without omitting entire rows or
columns (margins). On the other hand, you can convert the array into a
vector (analogous to conditioning on A:B:C) and then omit individual
NA cells.

-Deepayan



More information about the R-help mailing list