apply: Apply Functions Over "matter" Matrices

Description Usage Arguments Details Value Warning Author(s) See Also Examples

Description

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

Usage

1
2
3
4
5
6
7
8
## S4 method for signature 'matter_mat'
apply(X, MARGIN, FUN, ..., BPPARAM = bpparam())

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

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

Arguments

X

A matter matrix-like 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.

BPPARAM

An optional instance of BiocParallelParam. See documentation for bplapply.

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. When performed in parallel, the matter metadata is serialized to each R session, so all workers must be able to access the data via the same paths().

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

1
2
3
4
5
register(SerialParam())

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

apply(x, 2, summary)

matter documentation built on Nov. 8, 2020, 6:15 p.m.