Saptarshi Guha
2008-Oct-05 19:45 UTC
[R] Conditioning variables in lattice - not all combinations
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.) Is there a way to solve this? Also, each level of C appears in exactly one combination of A and B (the combinations that appear in the data set, not the ones produced by lattice) Kind regards Saptarshi Saptarshi Guha | saptarshi.guha@gmail.com | http://www.stat.purdue.edu/~sguha [[alternative HTML version deleted]]
Deepayan Sarkar
2008-Oct-05 20:09 UTC
[R] Conditioning variables in lattice - not all combinations
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