Skip to content
Prev 348085 / 398500 Next

Sorting Surv objects

It seems that Surv objects do not sort correctly.   This seems to be a bug.  Anyone else found this?
[1] 4+ 3  1+ 2  5+
[1] "Surv"
[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]}
[1] 1+ 2  3  4+ 5+

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