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

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
03 May 2000 07:49:26 +0200


Thomas Lumley <thomas@biostat.washington.edu> writes:

> In this particular case you know that x has class c("ordered","factor")
> and that you want it to have class "factor", so it is harmless. It still
> may be unnecessary -- eg if you just want it to have treatment contrasts
> rather than polynomial contrasts you can use C() or constrasts()<-.

We do have a problem in the documentation:

The default for factor is ordered=FALSE according to the help page but

> factor(ordered(4:1),ordered=F)
[1] 4 3 2 1
Levels:  1 2 3 4 
> factor(ordered(4:1))
[1] 4 3 2 1
Levels:  1 < 2 < 3 < 4 

and the actual function definition says

function (x, levels = sort(unique(x), na.last = TRUE),
                    labels=levels, exclude = NA, ordered =
                    is.ordered(x))



-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._