Expand Survival Data into Long Format for Discrete-Time Models
Usage
dataLong(
dataSet,
timeColumn,
censColumn,
timeAsFactor = TRUE,
remLastInt = FALSE,
aggTimeFormat = FALSE,
lastTheoInt = NULL
)
Arguments
- dataSet
A
data.frame
containing the survival data.- timeColumn
A character string giving the name of the column with observed survival times.
- censColumn
A character string giving the name of the column with the event indicator (0 = censored, 1 = event).
- timeAsFactor
Logical; if
TRUE
, the time intervals are returned as a factor, otherwise as numeric values.- remLastInt
Logical; if
TRUE
, removes observations in the final interval where hazard is always 1.- aggTimeFormat
Logical; if
TRUE
, expands to a fixed number of intervals given bylastTheoInt
, regardless of observed time.- lastTheoInt
Integer; the maximum theoretical number of intervals. Required if
aggTimeFormat = TRUE
.