[R] Why the factor levels returned by cut() are not ordered?

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Wed Nov 29 12:08:21 CET 2006


Wolfram Fischer wrote:
> What is the reason, that the levels of the factor
> returned by cut() are not marked as ordered levels?
>
>   
>> is.ordered( cut( breaks=3, sample(10 ) ) )
>>     
> FALSE
>
>   
It would arguably be the Right Thing, but there would be complications
in modeling, where ordered factors result in polynomial contrast coding.
(This, in my opinion, is a design mistake inherited from S, but it's not
easy to change at this stage.)
>> help(factor)
>>     
>     ...
>     If 'ordered' is 'TRUE', the factor levels are assumed to be ordered.
>     ...
>
> Wolfram
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>   


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list