Braem M
2009-Jan-26 22:44 UTC
[R] Error in Surv(time, status) : Time variable is not numeric
Dear, I want to analyze two-level survival data using a shared frailty model, for which I want to use the R package 'Frailtypack", proposed by Rondeau et al. The dataset was built using SAS software. I also tried to change the format using SPSS and Excell. My (reduced) dataset has following column names: ID entry time status family var1 I used following command:> frailtyPenal(Surv(time, status) ~var1 + cluster(family), Frailty=TRUE > ,n.knots=8, kappa1=1500,+ cross.validation=FALSE) And got this error : Error in Surv(time, status) : Time variable is not numeric In addition: Warning message: In is.na(time) : is.na() applied to non-(list or vector) of type 'closure' I think R transforms the data when importing into R, so that the observations are not numeric anymore. Does anyone know how to handle this problem? Thanks, Marie -- View this message in context: http://www.nabble.com/Error-in-Surv%28time%2C-status%29-%3A-Time-variable-is-not-numeric-tp21674025p21674025.html Sent from the R help mailing list archive at Nabble.com.
Chris Andrews
2009-Jan-27 12:01 UTC
[R] Error in Surv(time, status) : Time variable is not numeric
R is finding the R function 'time' rather than your variable time in your dataset. Perhaps adding 'data=mydata' to your function call will resolve your issue. Chris Braem M wrote:> > Dear, > > I want to analyze two-level survival data using a shared frailty model, > for which I want to use the R package 'Frailtypack", proposed by Rondeau > et al. The dataset was built using SAS software. I also tried to change > the format using SPSS and Excell. > > My (reduced) dataset has following column names: > ID entry time status family var1 > > I used following command: >> frailtyPenal(Surv(time, status) ~var1 + cluster(family), Frailty=TRUE >> ,n.knots=8, kappa1=1500, > + cross.validation=FALSE) > > And got this error : > Error in Surv(time, status) : Time variable is not numeric > In addition: Warning message: > In is.na(time) : is.na() applied to non-(list or vector) of type 'closure' > > I think R transforms the data when importing into R, so that the > observations are not numeric anymore. > > Does anyone know how to handle this problem? > > Thanks, > > Marie >-- View this message in context: http://www.nabble.com/Error-in-Surv%28time%2C-status%29-%3A-Time-variable-is-not-numeric-tp21674025p21683673.html Sent from the R help mailing list archive at Nabble.com.