It seems that Surv objects do not sort correctly.   This seems to be a bug.  
Anyone else found this?

>survival.data
[1] 4+ 3  1+ 2  5+
>class(survival.data)
[1] "Surv"
>sort(survival.data)
[1] 2  1+ 4+ 3  5+

An easy work-around is to define a function sort.Surv

>sort.Surv<-function(a){ord<-order(a[,1]); a[ord]}
>sort(survival.data)
[1] 1+ 2  3  4+ 5+

I am using R 3.1.2 GUI 1.65 Mavericks build (6833) running under Yosemite.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to