Unable to create survival object: "Temporary variable is not numeric" error

I am trying to create a survival object using this command.

Surv(date1, date2, event=status) 

This led to the error "Temporary variable is not numeric." Note that the classes "date1" and "date2" are Date.

Do I need to force Date objects into numeric objects before creating survival objects? I think this makes no sense.

+4
source share
1 answer

The temporary variable must be numeric for the survival function to work, or in your case you can do something like: Surv(as.numeric(date2 - date1), event=status)

+2
source

Source: https://habr.com/ru/post/1436081/


All Articles