From kevin.wright@pioneer.com  Mon Sep  9 15:22:59 2002
From: kevin.wright@pioneer.com (Wright, Kevin)
Date: Mon, 9 Sep 2002 09:22:59 -0500
Subject: No reorder.factor in R
Message-ID: <C71CB7425639D311A7A40008C7286AB006A54FBF@carina.phibred.com>


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


No reorder.factor in R
Wright, Kevin