Subset a single cell experiment object by sampling the number of specified cells, optionally by grouping. If neither n, frac or n_max is specified the lowest number of cells in group will be used.

sample_cells(x, ...)

# S3 method for Seurat
sample_cells(x, group = NULL, n = NULL, frac = NULL, n_max = NULL, ...)

# S3 method for SingleCellExperiment
sample_cells(x, group = NULL, n = NULL, frac = NULL, ...)

Arguments

x

an object to sample from.

...

parameters passed down to methods.

group

optional grouping variable.

n

number of cells to sample (per group).

frac

fraction of cells to sample (per group).

n_max

number of cells to sample, if less cells available then all cells returned.