# [Rd] Possible bug in factor (PR#531)

**mh.smith@auckland.ac.nz
**
mh.smith@auckland.ac.nz

*Wed, 3 May 2000 01:46:33 +0200 (MET DST)*

The expressions
>* x<-factor(x)
*
and
>* class(x)<-"factor"
*
behave differently when x is already an ordered factor. It may not be a
bug but it caught me out when I was trying to remove the "orderedness"
from a factor variable. The following R code illustrates the difference.
Is this difference between the 2 commands desirable?
>* x<-1:3
*>* class(x)
*NULL
>* x<-ordered(x)
*>* class(x)
*[1] "ordered" "factor"
>* x<-factor(x)
*>* class(x)
*[1] "ordered" "factor"
>* class(x)<-"factor"
*>* class(x)
*[1] "factor"
Murray Smith
--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Murray H. Smith, Senior Lecturer in Engineering Statistics
Engineering Science Department
The University of Auckland
Private Bag 92019
Auckland
New Zealand
Phone: +64 9 373 7599 x4517, Fax: +64 9 373 7468
email: mh.smith@auckland.ac.nz
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._