
Split Longitudinal and Survival Data into Subject-level Samples
slicer.RdThis function partitions a longitudinal dataset and a survival dataset at the subject level, returning two lists of sliced datasets for model fitting in parallel or series.
Arguments
- n_slices
an integer scalar giving the number of data slices (subsamples) to create.
- id_var
a character scalar with the name of the subject identifier variable in both
data_longanddata_surv.- data_long
a data frame containing the longitudinal measurements.
- data_surv
a data frame containing the survival (time-to-event) information.
- seed
an integer seed used to randomize the assignment of subject IDs to slices.
Value
A list with two components:
longa list of length
n_sliceswith class"sliced_data". Each element is a data frame containing the longitudinal rows for the subjects assigned to that slice.surva list of length
n_sliceswith class"sliced_data". Each element a data frame containing the survival rows for the subjects assigned to that slice.
Author
Pedro Miranda-Afonso p.mirandaafonso@erasmusmc.nl