From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>

Date: Wed 07 Dec 2005 - 07:12:22 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Dec 07 07:43:13 2005

Date: Wed 07 Dec 2005 - 07:12:22 EST

On 12/6/05, Christoph Scherber <Christoph.Scherber@uni-jena.de> wrote:

> Dear R users,

*>
**> I have a question regarding the use of xyplot in the lattice() package.
**> I have two factors (each with two levels), and IÂ´d like to change the
**> order of the panels in a 2x2 panel layout from the default alphabetic
**> order that R uses based on the names of the factor levels.
**>
**> My approach is (in principle)
**>
**> xyplot(y~x|Factor1+Factor2)
**>
**> LetÂ´s assume, my factor levels for Factor1 are A and B,
**> and for Factor2 theyÂ´re C and D, respectively.
**>
**> Now the default arrangement of my panels would be (from bottom top left
*

I assume you mean 'top left'

> to bottom right): "BC","CA","BD","AD"

No it won't, unless you meant

xyplot(y~x|Factor2+Factor1)

Instead of describing your problem 'in principle' (which can be very confusing when you make a mistake), please do as the posting guide asks and give a reproducible example. Anyone trying to answer you will have to come up with an example anyway, and since it's your problem, it might as well be you.

*> What IÂ´d like to have is "BD","AC","BC","AD".
*

This is impossible if you have two conditioning factors (whichever way you count, the combination following "BD" has to have at least one of "B" and "D" in it). If you want to lose the 2-factor structure, create an interaction, after which you can reorder its levels any way you want, e.g.

d <-

data.frame(f1 = sample(gl(2, 10, labels = LETTERS[1:2])),

f2 = sample(gl(2, 10, labels = LETTERS[3:4])), x = rnorm(20), y = rnorm(20))

xyplot(y ~ x | f1:f2, d)[c(1, 2, 4, 3)]

which is a shortcut for

xyplot(y ~ x | f1:f2, d, index.cond = list(c(1, 2, 4, 3)))

-Deepayan

> Can anyone tell me how to solve this problem easily?

*>
**> IÂ´ve read that using "perm.cond" and/or "index.cond" could solve this
**> problem, but couldnÂ´t find an appropriate example, unfortunately...
*

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Dec 07 07:43:13 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:41:30 EST
*