apply {matter}R Documentation

Apply Functions Over “matter” Matrices

Description

An implementation of apply for matter_mat, sparse_mat and virtual_mat matrices.

Usage

## S4 method for signature 'matter_mat'
apply(X, MARGIN, FUN, ...)

## S4 method for signature 'sparse_mat'
apply(X, MARGIN, FUN, ...)

## S4 method for signature 'virtual_mat'
apply(X, MARGIN, FUN, ...)

Arguments

X

A matter_mat object.

MARGIN

Must be 1 or 2 for matter_mat matrices, where ‘1’ indicates rows and ‘2’ indicates columns. The dimension names can also be used if X has dimnames set.

FUN

The function to be applied.

...

Additional arguments to be passed to FUN.

Details

Because FUN must be executed by the interpreter in the appropriate R environment, the full row or column will be loaded into memory. The chunksize of X is ignored. For summary statistics, functions like colMeans and rowMeans offer greater control over memory pressure.

Value

See apply for details.

Warning

Applying a function over the rows of a column-major matrix (e.g., matter_matc) or over the columns of a row-major matrix (e.g., matter_matr) may be very slow.

Author(s)

Kylie A. Bemis

See Also

apply

Examples

x <- matter(1:100, nrow=10, ncol=10)

apply(x, 2, summary)

[Package matter version 1.8.3 Index]