Re: [R] lattice -- panel order display

From: Deepayan Sarkar <deepayan_at_stat.wisc.edu>
Date: Wed 02 Mar 2005 - 03:08:28 EST

On Tuesday 01 March 2005 08:50, Luis Ridao Cruz wrote:
> R-help,
>
> I'm using 'xyplot' in lattice package which plots length frecuencies
> by year (10).
> The order I get is not logical and the 'index.cond' argument to
> 'xyplot' is a bit cumbersome when it comes to plot a great deal of
> (in my case years).
>
> I have tried sorting the conditioning variable but still get the same
> result.
>
> Is there any easy way to do it without making use of 'index.cond' ?
>
> The function call is as follows:
>
> xyplot ( number ~ cm | as.factor(test$year) , data=test)

The order of panels would be the same as you would get by

> levels(as.factor(test$year))

So what you really need to figure out is how to explicitly specify the order of levels when creating a factor. In other words, this is not a lattice issue.

How best to do this depends on details you haven't given, specifically, what you think the 'logical' order is. Reading ?factor and ?reorder.factor might help.

-Deepayan



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 Mar 02 04:01:44 2005

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