apply-methods: apply() for big.matrix objects

apply,big.matrix-methodR Documentation

apply() for big.matrix objects

Description

apply for big.matrix objects. Note that the performance may be degraded (compared to apply with regular R matrices) because of S4 overhead associated with extracting data from big.matrix objects. This sort of limitation is unavoidable and would be the case (or even worse) with other "custom" data structures. Of course, this would only be partically significant if you are applying over lengthy rows or columns.

Usage

## S4 method for signature 'big.matrix'
apply(X, MARGIN, FUN, ..., simplify = TRUE)

Arguments

X

a big.matrix object.

MARGIN

the margin. May be may only be 1 or 2, but otherwise conforming to what you would expect from apply().

FUN

the function to apply.

...

other parameters to pass to the FUN parameter.

simplify

see the base::apply documentation.

Examples

library(bigmemory)
options(bigmemory.typecast.warning=FALSE)
x <- big.matrix(5, 2, type="integer", init=0,
                dimnames=list(NULL, c("alpha", "beta")))
x[,] <- round(rnorm(10))
biganalytics::apply(x, 1, mean)

kaneplusplus/biganalytics documentation built on April 3, 2024, 12:34 a.m.