Wrapper function for data file in survival analysis.

data_survival(time, treatment, event, .data = NULL)

Arguments

time

vector. exposure time for the subjects. It must be the same length as the treatment variable.

treatment

vector. Treatment assignment for patients, 1 for treatment group and 0 for control group

event

vector. The status indicator, normally 0=alive, 1=dead. Other choices are TRUE/FALSE (TRUE = death) or 1/2 (2 = death). For censored data, the status indicator is 0 = right censored, 1 = event at time. Although unusual, the event indicator can be omitted, in which case all subjects are assumed to have an event.

.data

NULL. Stores the survival data for analysis. Should not be edited by the user.

Value

A list with time, treatment, and event with time-to-event outcome.

Examples

data_survival(time = c(6.2, 8.2, 8.0, 2.3), treatment = c(0, 1, 0, 1), event = c(1, 1, 1, 1))
#> $time #> [1] 6.2 8.2 8.0 2.3 #> #> $treatment #> [1] 0 1 0 1 #> #> $event #> [1] 1 1 1 1 #>