applyFunctionSparsely: Apply function sparsely

Description Usage Arguments Value Author(s) Examples

Description

Applies a function to the nonzero elements of a sparse vector or matrix

Usage

1

Arguments

z

a sparse vector or matrix

f

a function

Value

Returns the variable z, with only the value of the nonzero elements changed

Author(s)

Michael Love

Examples

1
2
3
sds <- simulateSparseDataSet(100, c(5,5))
logPlusOne <- function(x) log(x + 1)
sparseData(sds) <- applyFunctionSparsely(sparseData(sds), logPlusOne)

mikelove/SparseData documentation built on May 22, 2019, 10:52 p.m.