
Aggregate sets' quantitative samples
Source:R/QFeatures-aggregation.R
QFeatures-aggregateSamples.RdThis function aggregates quantitative samples, applying a
summarisation function (fun) to sets of samples defined by a
colData variable.
For QFeatures objects, the aggregated set colData is added to
the global colData using addAssay(). If an aggregated group name
already exists as a row name in the global colData, it is reused
only when shared colData variables do not contain conflicting
values, otherwise an error is thrown. The aggregation of samples should
take place after run joining.
Usage
# S4 method for class 'SummarizedExperiment'
aggregateSamples(object, scol, fun = rowRobustSummary, ...)
# S4 method for class 'QFeatures'
aggregateSamples(
object,
i,
scol,
name = "newAssay",
fun = rowRobustSummary,
...
)Arguments
- object
An instance of class QFeatures or SummarizedExperiment.
- scol
A
character()naming thecolDatavariable defining how to group samples. When multiple variables are supplied, their values are concatenated with_to build the grouping variable.- fun
A function used to aggregate the samples. The function should apply its summarization row-wise.
- ...
Additional parameters passed to
fun.- i
A
character(1)naming the set that will be aggregated.- name
A
character(1)naming the new set.
Value
A QFeatures object with an additional set or a
SummarizedExperiment object. The new set/SummarizedExperiment
contains three assays the first named assay containing the result
of the aggregation, the second named aggsd containing the standard
deviation associated with each aggregated data point and the third
named aggcounts containing the number of observation used for each
aggregated data point.