Skip to contents

Enables fast computations across columns or rows (margin=1 and 2 respectively) Only matrix, dgeMatrix, dgTMatrix, dgCMatrix, or dgRMatrix types are supported. adapted from https://stackoverflow.com/questions/55407656/r-sweep-on-a-sparse-matrix

Usage

sweep_sparse(x, margin, stats, fun = "*")

Arguments

x

A matrix (matrix, dgeMatrix, dgTMatrix, dgCMatrix, or dgRMatrix).

margin

Across columns or rows (margin=1 and 2 respectively)

stats

The column name in metadata for grouping

fun

function to be applied for each item in stats to x (along margin)

Value

A matrix