Learn R Programming

pencal (version 2.3.0)

prepare_longdata: Prepare longitudinal data for PRC

Description

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)

Usage

prepare_longdata(df, t.from.base, subj.id, survtime, verbose = TRUE)

Value

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

Arguments

df

dataframe with the longitudinal measurements

t.from.base

name (as character) of the variable containing time from baseline in df

subj.id

name of the subject id variable in df

survtime

vector containing the survival time or censoring time

verbose

if TRUE, a summary of the data manipulation is printed

Author

Mirko Signorelli

References

Signorelli, M. (2024). pencal: an R Package for the Dynamic Prediction of Survival with Many Longitudinal Predictors. The R Journal, 16 (2), 134-153.