aggregate: Aggregate

aggregateR Documentation

Aggregate

Description

Aggregate

Usage

aggregate(x, ...)

## S4 method for signature 'SingleCellExperiment'
aggregate(x, col = "aggregate", fun = "sum", MARGIN = 1L)

Arguments

x

Object.

col

character(1). Name of column in either rowData() or colData() that defines the desired aggregation groupings.

fun

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

MARGIN

integer(1-2). Dimension where the function will be applied. For a two-dimensional matrix: 1 indicates rows; 2 indicates columns; c(1, 2) indicates rows and columns.

...

Additional arguments.

Value

SingleCellExperiment.

Methods (by class)

  • aggregate(SummarizedExperiment): Arguments pass through to matrix or Matrix method, depending on the class of matrix defined in requested assay.

Methods (by class)

  • matrix, Matrix: Aggregate using a grouping factor.

  • SummarizedExperiment: Aggregate data slotted in assays() using an automatically generated grouping factor, which is obtained from a user-defined column (col argument) in either the rowData() or colData() of the object. Slot an aggregate column into rowData() for aggregateRows(), or into colData() for aggregateCols(). This method will define the groupings automatically, and perform the aggregation.

Note

Updated 2022-05-24.

Author(s)

Michael Steinbaugh, Rory Kirchner

See Also

  • stats::aggregate().

  • S4Vectors::aggregate().

  • Matrix.utils::aggregate.Matrix().

  • muscat::aggregateData().

Examples

data(SingleCellExperiment_lanesplit, package = "AcidTest")

## SingleCellExperiment ====
x <- SingleCellExperiment_lanesplit
levels(SummarizedExperiment::colData(x)[["aggregate"]])
x <- aggregate(
    x = x,
    col = "aggregate",
    fun = "sum",
    MARGIN = 2L
)
print(x)

acidgenomics/r-acidsinglecell documentation built on March 30, 2024, 5:39 a.m.