by_cluster_sampling: Balanced downsampling of matrix/data.frame based on cluster...

View source: R/utils.R

by_cluster_samplingR 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
)

colorrepel documentation built on Aug. 8, 2025, 7:12 p.m.