[R] bwplot reorder factor on y axis

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jan 4 21:18:12 CET 2006

On Wed, 4 Jan 2006, Michael Kubovy wrote:

> In bwplot(pairL ~ asym, oppK) is a factor. It displays pairL in
> alphabetical order. How do I tell it to display, pairL in the order I
> wish , i.e., so the medians of asym are in ascending order?

Actually, it displays pairL in the order of its levels. Trellis for S came 
with a function reorder.factor to re-order the levels, and base R has it 
too.  There is a very similar example on ?reorder.  More generally, see 

(There are other reorder.factor functions in Hmisc and gdata, which you 
may need to avoid.)

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list