powered by
Balanced downsampling of matrix/data.frame based on cluster assignment vector
by_cluster_sampling(df, vec, frac, seed = 34)
list with new downsampled matrix/data.frame and id vector
expression matrix or data.frame
vector of ids
fraction 0-1 to downsample to
sampling randomization seed
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 )
Run the code above in your browser using DataLab