by_cluster_sampling {colorrepel} | R Documentation |
Balanced downsampling of matrix/data.frame based on cluster assignment vector
Description
Balanced downsampling of matrix/data.frame based on cluster assignment vector
Usage
by_cluster_sampling(df, vec, frac, seed = 34)
Arguments
df |
expression matrix or data.frame |
vec |
vector of ids |
frac |
fraction 0-1 to downsample to |
seed |
sampling randomization seed |
Value
list with new downsampled matrix/data.frame and id vector
Examples
res <- by_cluster_sampling(data.frame(y = c(1, 2, 3, 4, 5, 6)),
vec = c(1, 2, 1, 2, 1, 2), frac = 0.5
)
[Package colorrepel version 0.4.1 Index]