This is an internal function used by calculate_covariance for bootstrapping data that may be either in wide format (i.e. one row per individual) or long format (i.e. one row per study visit per individual). This function takes in a list of resampled IDs, retrieves all rows of data corresponding to these IDs, and creates a unique ID that preserves the nesting structure of long format of data.
Arguments
- data
A
data.frame
to be resampled, which must contain a column named.id
which uniquely identifies all rows corresponding to an individual.- ids
a vector of IDs that have already been resampled from
data
- resample
Logical scalar: Should the IDs be resampled for computing a bootstrap replicate from a list of unique IDs?
- convert_id_to_factor
Logical scalar: Should the ID column be converted to a factor?