From ripley@stats.ox.ac.uk  Mon Sep  9 16:15:03 2002
From: ripley@stats.ox.ac.uk (Prof Brian D Ripley)
Date: Mon, 9 Sep 2002 16:15:03 +0100 (BST)
Subject: No reorder.factor in R
In-Reply-To: <C71CB7425639D311A7A40008C7286AB006A54FBF@carina.phibred.com>
Message-ID: <Pine.GSO.4.44.0209091612320.16459-100000@auk.stats>

reorder.factor is part of Trellis and I believe little used elsewhere.
That makes it a prime candidate for lattice.

I always thought it should be called `order.factor' as factors are not
normally ordered (although Trellis assumes they are).

On Mon, 9 Sep 2002, Wright, Kevin wrote:

>
> I was using R 1.5.1 today with an old script from S-Plus and discovered that
> R does not have reorder.factor.
>
> It's a very simple function, but very handy for re-arranging factors in
> lattice graphics (among other places).  Would it make sense to add this
> function to the base code
> in order to increase compatability with S-Plus and add additional
> functionality?
>
> reorder.factor <- function(fac, y, fun=mean, ...){
>   ordered(fac, levels=levels(fac)[order(tapply(y, fac, fun, ...))])
> }
>
>
> Kevin Wright, Research Scientist
> Pioneer Hi-Bred Int'l, x4054.
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


No reorder.factor in R
Prof Brian D Ripley