Surv2 {survival}R Documentation

Create a survival object


Create a survival object from a timeline style data set. This will almost always be the response variable in a formula.


Surv2(time, event, repeated=FALSE)



a timeline variable, such as age, time from enrollment, date, etc.


the outcome at that time. This can be a 0/1 variable, TRUE/FALSE, or a factor. If the latter, the first level of the factor corresponds to ‘no event was observed at this time’.


if the same level of the outcome repeats, without an intervening event of another type, should this be treated as a new event?


This function is still experimental.

When used in a coxph or survfit model, Surv2 acts as a trigger to internally convert a timeline style data set into counting process style data, which is then acted on by the routine.

The repeated argument controls how repeated instances of the same event code are treated. If TRUE, they are treated as new events, an example where this might be desired is repeated infections in a subject. If FALSE, then repeats are not a new event. An example would be a data set where we wanted to use diabetes, say, as an endpoint, but this is repeated at each medical visit.


An object of class Surv2. There are methods for print, and subscripting.

See Also

Surv2data, coxph, survfit

[Package survival version 3.6-4 Index]