This function removes from a longitudinal dataframe
all measurements taken after the occurence of the event
or after censoring. It is used internally by fit_lmms
and it assumes that df
is sorted by subj.id
,
with survival times given in the same order by subject id
(fit_lmms
automatically performs this sorting when
needed)
prepare_longdata(df, t.from.base, subj.id, survtime, verbose = TRUE)
A list containing: a reduced dataframe called df.sanitized
,
where only measurements taken before t
are retained; the number of
measurements retained (n.kept
) and removed (n.removed
)
from the input data frame
dataframe with the longitudinal measurements
name (as character) of the variable containing
time from baseline in df
name of the subject id variable in df
vector containing the survival time or censoring time
if TRUE
, a summary of the data manipulation
is printed
Mirko Signorelli
Signorelli, M. (2024). pencal: an R Package for the Dynamic Prediction of Survival with Many Longitudinal Predictors. The R Journal, 16 (2), 134-153.