timesTokeep {ipcwswitch} | R Documentation |
Function to keep all event times
Description
Function to keep all event times
Usage
timesTokeep(data, id, tstart, tstop, mes.cov, time.cov)
Arguments
data |
dataframe containing the following variables |
id |
patient's id |
tstart |
date of the beginning of the follow-up (in Date format) |
tstop |
date of the end of the follow-up (in Date format) |
mes.cov |
list of vectors, each of them must contain the names (in character format) of the repeated measurements related to one time-dependent covariate |
time.cov |
list of vectors, each of them must contain the times (in Date format) of the date when the abovementioned measurements were done |
Value
list of two lists, one in Date format the other in numeric format. Each of them contains, for each patient, the event time and the times of changes in time-varying covariates
References
Graffeo, N., Latouche, A., Le Tourneau C., Chevret, S. (2019) "ipcwswitch: an R package for inverse probability of censoring weighting with an application to switches in clinical trials". Computers in biology and medicine, 111, 103339. doi : "10.1016/j.compbiomed.2019.103339"
See Also
Examples
kept.t <- timesTokeep(toydata, id = "id",
tstart = "randt", tstop = "lastdt",
mes.cov = list(c("ps1", "ps2", "ps3")),
time.cov = list(c("randt", "dt2", "dt3")))
# For example, for patient id=3, to obtain the kept times in Date format:
kept.t[[1]][[3]]
# To obtain the kept times in numeric format:
kept.t[[2]][[3]]