Provides functions to split a SampleDataset object by sample, patient, or visit.
Usage
split_by_sample(
dataset,
ratios,
seed = NULL,
stratify = FALSE,
stratify_by = NULL,
get_index = FALSE
)Arguments
- dataset
A
SampleDatasetobject.- ratios
A numeric vector of length 3 indicating train/val/test split ratios. Must sum to 1.
- seed
Optional integer for reproducibility.
- stratify
Logical, whether to perform stratified sampling. Default: FALSE.
- stratify_by
Character, the name of the field to stratify by (e.g., the label). Required if
stratifyis TRUE.- get_index
Logical, whether to return the indices instead of subsets. Default: FALSE.