Learn R Programming

scUtils (version 0.1.0)

colVars_spm: 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.

Value

Vector with variances.

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.

See Also

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

Examples

Run this code
# NOT RUN {
library(Matrix)
 mat <- as(matrix(rpois(900,1), ncol=3), "dgCMatrix")
 colVars_spm(mat)
# }

Run the code above in your browser using DataLab