[R] re-ordering bwplot

Peter Ehlers ehlers at ucalgary.ca
Fri Jul 23 19:58:22 CEST 2010


On 2010-07-23 11:36, Deepayan Sarkar wrote:
> On Fri, Jul 23, 2010 at 10:02 AM, Eck, Bradley J
> <brad.eck at mail.utexas.edu>  wrote:
>> Dear list:
>>
>> I'm using bwplot to compare concentrations by location and treatment as in:
>>
>> # using built in data
>> bwplot( conc ~ Type : Treatment, data = CO2 )
>>
>> I would like the order of the plots to be: 3,4,1,2. Â  I can't seem to figure this out with index.cond or permc.cond.
>>
>> Any help is appreciated!
>
> I think the only way is to
>
> (1) explicitly create the interaction variable
>
> (2) re-create the factor using factor() with your desired levels
>
> This should be done before the bwplot() call.
>
> -Deepayan

Deepayan's suggestion is the way to go. But in this
simple example you can just relevel the factors:

  bwplot( conc ~ relevel(Type, ref=2) : Treatment, data = CO2 )

and/or relevel 'Treatment'. This is only trivially
different from applying relevel() before calling bwplot().

(BTW: is your ":" meant to be "|"?)

   -Peter Ehlers



More information about the R-help mailing list