[R] reorder always returns "ordered"

Bill.Venables at csiro.au Bill.Venables at csiro.au
Wed Oct 6 00:30:36 CEST 2010


R-bugs is the appropriate place to report this.

It may be particular to your system.  Here's what happens on mine (Windows XP, R 2.11.1)

> f <- factor(1:5)
> g <- reorder(f, rnorm(5))
> is.ordered(g)
[1] FALSE
> g
[1] 1 2 3 4 5
attr(,"scores")
         1          2          3          4          5 
-0.8120604 -0.0620255 -0.3724164  0.5652610 -0.3373658 
Levels: 1 3 5 2 4
> 

All seems in order (so to speak). 

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Darin A. England
Sent: Wednesday, 6 October 2010 8:15 AM
To: R Help
Subject: [R] reorder always returns "ordered"

Or at least is seems that way to me. It's not a big problem, but the
behavior doesn't match the documentation. (I think r-help is the
place to report this. )

> x <- factor(1:5)
> x.ro <- reorder(x, rnorm(5))
> is.ordered(x.ro)  # should be FALSE according to ?reorder
[1] TRUE
> 
> x.ro <- reorder(x, rnorm(5), ordered=FALSE)
> is.ordered(x.ro)  # should be FALSE
[1] TRUE


Here is my session info:
> sessionInfo()
R version 2.11.1 (2010-05-31) 
x86_64-unknown-linux-gnu 

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] splines   datasets  utils     stats     graphics  grDevices
methods  
[8] base     

other attached packages:
[1] Design_2.3-0    Hmisc_3.8-3     survival_2.35-8 RODBC_1.3-2    
[5] MASS_7.3-7      lattice_0.19-11

loaded via a namespace (and not attached):
[1] cluster_1.13.1 grid_2.11.1    tools_2.11.1

______________________________________________
R-help at r-project.org 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.



More information about the R-help mailing list