| slicer | R Documentation |
This 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.
slicer(n_slices, id_var, data_long, data_surv, seed = 123L)
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_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. |
A list with two components:
longa list of length n_slices with 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_slices with class "sliced_data".
Each element a data frame containing the survival rows for
the subjects assigned to that slice.
Pedro Miranda-Afonso p.mirandaafonso@erasmusmc.nl
data(pbc2, package = "JMbayes2")
data(pbc2.id, package = "JMbayes2")
pbc2_slc <- slicer(n_slices = 2, id_var = "id", data_long = pbc2,
data_surv = pbc2.id, seed = 123L)
length(pbc2_slc$long) # 2
length(pbc2_slc$surv) # 2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.