Learn R Programming

biganalytics (version 1.1.22)

apply,big.matrix-method: 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 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

Run this code
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)

Run the code above in your browser using DataLab