apply {matter} | R Documentation |
An implementation of apply
for matter_mat
, sparse_mat
and virtual_mat
matrices.
## S4 method for signature 'matter_mat' apply(X, MARGIN, FUN, ..., BPPARAM = bpparam(), simplify = TRUE) ## S4 method for signature 'sparse_mat' apply(X, MARGIN, FUN, ..., BPPARAM = bpparam(), simplify = TRUE) ## S4 method for signature 'virtual_mat' apply(X, MARGIN, FUN, ..., BPPARAM = bpparam(), simplify = TRUE)
X |
A |
MARGIN |
Must be 1 or 2 for |
FUN |
The function to be applied. |
... |
Additional arguments to be passed to |
BPPARAM |
An optional instance of |
simplify |
Should the result be simplified? |
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()
.
See apply
for details.
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.
Kylie A. Bemis
register(SerialParam()) x <- matter(1:100, nrow=10, ncol=10) apply(x, 2, summary)