View source: R/divide_samples.R View source: R/divide_samples_alternative.R
divide_samples | R Documentation |
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.
divide_samples(n_samples, num, min_size)
divide_samples(n_samples, num, min_size)
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. |
This function is primarily used for randomized simulation of sample blocks, useful in bootstrapping, subsampling, or simulating latent factor scores across multi-omics datasets.
A list of integer vectors. Each vector contains a sequence of indices representing a subsample of the corresponding segment.
divide_samples(n_samples = 100, num = 3, min_size = 10)
divide_samples(n_samples = 50, num = 1, min_size = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.