matLog2: log2-scale transform a dense OR sparse matrix

View source: R/Utilities.R

matLog2R Documentation

log2-scale transform a dense OR sparse matrix

Description

This avoids the creation of a dense intermediate matrix when operating on sparse matrices

Usage

matLog2(spmat, scale = FALSE, scaleFactor = 1e+06)

Arguments

spmat

sparse Matrix

scale

boolean - whether or not to scale the columns to sum to 'scale_factor'

scaleFactor

if scale = TRUE, columns are scaled to sum to this number

Details

Either performs result <- log2(spmat+1) or if scale = TRUE returns result <- log2(spmat/colSums(spmat)*scaleFactor + 1)

Value

logmat sparse Matrix


YosefLab/FastProjectR documentation built on Feb. 15, 2023, 6:21 a.m.