[R] sorting Trellis panels

Deepayan Sarkar deepayan at cs.wisc.edu
Thu Jul 22 21:19:38 CEST 2004

Quoting Patrick Lorch <plorch at email.unc.edu>:

> Can anyone explain how to properly use index.cond?  I cannot include it 
> in the xyplot command and get what I expect.  For example,
> 	plot<-xyplot(y ~ x | z, data)
> # let's say z is a factor with six levels
> gives a nice plot but I am unhappy with the order of panels.  I can get 
> the order I want by
> 	plot$index.plot[[1]]<-c(1,6,4,3,2,5)
> I cannot seem to get it with either
> 	plot<-xyplot(y ~ x | z, data,index.cond=list(order(c(1, ,6,4,3,2,5))))
> or
> 	plot<-xyplot(y ~ x | z, data)
> 	plot
> 	update(plot,index.cond=list(order(c(1,6,4,3,2,5))))
> I suspect it is some obvious misunderstanding of my use of 
> list(order(...)).

I don't see why you are trying to use order. Dropping it should give you what
you want, i.e.,

xyplot(y ~ x | z, data, index.cond=list(c(1,6,4,3,2,5)))


More information about the R-help mailing list