Dear All,

since years I am struggling with Surv objects in data.frames. The following seems to have to do with it. See below the modified example from the help page of survSplit. The original works, as expected. If, however, a Surv object is added to the data.frame, each record gets doubled.
Is there some solution other than avoiding Surv objects in data.frames?

Thanks,
Heinz


require(survival)

## from the help page
aml3<-survSplit(aml,cut=c(5,10,50),end="time",start="start",
      event="status",episode="i")

summary(aml)
summary(aml3)

coxph(Surv(time,status)~x,data=aml)
## the same
coxph(Surv(start,time,status)~x,data=aml3)

## added to show doubling of records
aml.so <- aml
aml.so$surv.object <- with(aml, Surv(time, status))

aml3.so <- survSplit(aml.so ,cut=c(5,10,50),end="time",start="start",
                     event="status",episode="i")
summary(aml3.so)

sessionInfo('survival')
R version 2.9.1 Patched (2009-07-07 r48910)
i386-pc-mingw32

locale:
LC_COLLATE=German_Switzerland.1252;LC_CTYPE=German_Switzerland.1252;LC_MONETARY=German_Switzerland.1252;LC_NUMERIC=C;LC_TIME=German_Switzerland.1252

attached base packages:
character(0)

other attached packages:
[1] survival_2.35-4

loaded via a namespace (and not attached):
[1] base_2.9.1      graphics_2.9.1  grDevices_2.9.1 methods_2.9.1
[5] splines_2.9.1   stats_2.9.1     utils_2.9.1

______________________________________________
R-help@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.

Reply via email to