divide_samples {SUMO} | R Documentation |
Global Variable
Description
A global variable used in multiple functions.
This utility function divides a sequence of sample indices into num
segments
ensuring that each segment meets a specified minimum size. It optionally
extracts a subset of each segment based on predefined selection logic:
For a single group (
num = 1
): selects a random contiguous sub-vector comprising between 10% and 55% of the total samples.For multiple groups (
num > 1
): selects a contiguous sub-vector comprising approximately 75% of each segment.
Usage
divide_samples(n_samples, num, min_size)
divide_samples(n_samples, num, min_size)
Arguments
n_samples |
Integer. Total number of samples to divide. |
num |
Integer. Number of desired segments or latent factors. |
min_size |
Integer. Minimum size (length) allowed for each segment. |
Details
This function is primarily used for randomized simulation of sample blocks, useful in bootstrapping, subsampling, or simulating latent factor scores across multi-omics datasets.
Value
A list of integer vectors. Each vector contains a sequence of indices representing a subsample of the corresponding segment.
Examples
divide_samples(n_samples = 100, num = 3, min_size = 10)
divide_samples(n_samples = 50, num = 1, min_size = 5)