colVars_spm {scUtils}R Documentation

Variance computation for sparse matrices

Description

Compute variance for each column / each row of a dgCMatrix (from Matrix package).

Usage

colVars_spm(spm)

rowVars_spm(spm)

Arguments

spm

A sparse matrix of class dgCMatrix from the Matrix package.

Details

The only supported format currently is dgCMatrix. While the Matrix package has other formats, this one is used for scRNAseq raw count data. Function code written by Simon Anders.

Value

Vector with variances.

See Also

vignette("Intro2Matrix", package="Matrix") CsparseMatrix-class

Examples

library(Matrix)
 mat <- as(matrix(rpois(900,1), ncol=3), "dgCMatrix")
 colVars_spm(mat)

[Package scUtils version 0.1.0 Index]