[Rd] codes() has been deprecated

Roger Peng rpeng at stat.ucla.edu
Sun May 11 20:57:41 MEST 2003

I noticed on the developer's page under the notes for upgrading packages
for 1.8.0, it says:

coef() and coef<-() have been deprecated. 

This should be codes() and codes<-(), no?

UCLA Department of Statistics

On Fri, 9 May 2003, Prof Brian Ripley wrote:

> We have deprecated codes() in R-devel.  One we started looking into this, 
> we found that *all* the uses of codes() in the R sources and probably all 
> the uses in CRAN packages were not what we think was intended.
> For an ordered factor, codes() is the same as 
> unclass/as.vector/as.integer and so was unneeded.
> For an unordered factor, codes() does *not* retrieve the internal codes.  
> It effectively re-orders the levels into alphabetical order (in the
> current locale), forms a factor with those levels and then returns the
> internal codes.  This is rarely what is wanted, as if the levels are not
> in alphabetical order this is normally reflects some other natural order
> and the function should normallyrecognize that.  I normally use unclass()  
> to get the internal codes, but as.vector and as.integer work equally well.
> R has a codes() replacement function that is also deprecated, and of which 
> we can find no uses.
> Brian Ripley
> -- 
> 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
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list