survPrep.RdThis is a utility function for preparing a data frame for survival analysis.
survPrep(df, timevar='t', statusvar='status')
| df | A data frame to expand for survival analysis. Must contain a variable with time points > 0, and a binary response column indicating whether the event was observed (1) or not (0) at the observed time. Defaults to NULL. |
|---|---|
| timevar | The name of the column in df containing time values. Defaults to 't'. |
| statusvar | The name of the column in df containing the binary response. Defaults to 'status'. |
A data frame containing one row for every time point for every observation, up to the observed time for each observation. The statusvar is set to zero for all times before the observed time.