[R] How to override ordering of panels in xyplot()

Michael Kubovy kubovy at virginia.edu
Tue Mar 6 02:45:37 CET 2007


On Mar 3, 2007, at 3:19 PM, Deepayan Sarkar wrote:

> On 3/3/07, Michael Kubovy <kubovy at virginia.edu> wrote:
>> Dear r-helpers,
>>
>> I'm conditioning an xyplot on a variable whose levels are'low',  
>> 'med', 'high'. How do I override the alphabetical ordering for the  
>> panels of the plot?
>
> This has less to do with xyplot and more to do with the default of  
> the 'levels' argument in the factor() function. Just make sure the  
> levels are in the right order in your data when xyplot is called.

Unless one makes the factor ordered, reordering the levels of a  
factor does not seem to be a trivial matter. The only R function I've  
found that makes it easy is reorder_factor() (package:reshape). Or am  
I missing something?
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/



More information about the R-help mailing list