In a competing risks setting this function expands the data frame with a single row per subject to the a data frame in long format in which each subject has as many rows as the number of competing events.
crLong(data, statusVar, censLevel,
nameStrata = "strata", nameStatus = "status2")
A data frame in the long format with multiple rows per subject.
the data frame containing the competing risk data with a single row per subject.
a character string denoting the name of the variable in
data
that identifies the status variable which equals 1 if the
subject had any of the competing events and 0 otherwise.
a character string or a scalar denoting the censoring level
in the statusVar
variable of data
.
a character string denoting the variable that will be added
in the long version of data
denoting the various causes of event.
a character string denoting the variable that will be added
in the long version of data
denoting if the subject experience any
of the competing events.
Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl
Rizopoulos, D. (2012) Joint Models for Longitudinal and Time-to-Event Data: with Applications in R. Boca Raton: Chapman and Hall/CRC.
Putter, H., Fiocco, M., and Geskus, R. (2007). Tutorial in biostatistics: Competing risks and multi-state models. Statistics in Medicine 26, 2389--2430.
head(crLong(pbc2.id, "status", "alive"))
Run the code above in your browser using DataLab