Skip to contents

Aggregate a values matrix through a neighbor-weight matrix

Usage

aggregateByWeights(cell2se, weights, sum2one = TRUE, min.cells = 5)

Arguments

cell2se

matrix/data.frame, rows = source units (must align with `colnames(weights)`), columns = features (e.g. SE levels).

weights

sparse matrix, typically from `buildKNNWeights()`.

sum2one

if `TRUE`, normalize each output row to sum to 1 after aggregation.

min.cells

minimum number of source units (nonzero weight entries) an output unit must have to be kept in the result.

Value

dense matrix, dim = (kept output units) x ncol(cell2se)