Utilty function that factilites cell-to-sample aggregation. By default, this function will sum the counts across cells to sample level.

# S4 method for SingleCellExperiment
aggregateCellsToSamples(object,
  fun = c("sum", "mean"))

Arguments

object

Object.

fun

character(1). Name of the aggregation function. Uses match.arg() internally.

Value

SummarizedExperiment. Object with cell-level counts aggregated to sample-level.

Details

Internally aggregateCellsToSamples() automatically obtains the cell-to-sample groupings and then performs aggregation with the aggregateCols() function.

Examples

data(sce) x <- aggregateCellsToSamples(sce)
#> Aggregating counts using sum().
#> class: RangedSummarizedExperiment #> dim: 500 2 #> metadata(1): aggregate #> assays(1): counts #> rownames(500): gene1 gene2 ... gene499 gene500 #> rowData names(5): geneID geneName geneBiotype broadClass entrezID #> colnames(2): sample1 sample2 #> colData names(1): sampleName