lapply {matter} | R Documentation

## Apply Functions Over “matter” Lists

### Description

An implementation of `lapply` and `sapply` for `matter_list` objects.

### Usage

    ## S4 method for signature 'matter_list'
    lapply(X, FUN, ..., BPPARAM = bpparam())

    ## S4 method for signature 'matter_list'
    sapply(X, FUN, ..., BPPARAM = bpparam(),
    	simplify = TRUE, USE.NAMES = TRUE)

### Arguments

`X` | A `matter` list-like object.
`FUN` | The function to be applied.
`...` | Additional arguments to be passed to `FUN`.
`simplify` | Should the result be simplified into a vector, matrix, or higher dimensional array?
`USE.NAMES` | Use `names(X)` for the names of the answer. If `X` is a character, use `X` as `names` unless it has names already.
`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 list element will be loaded into memory. The `chunksize` of `X` is ignored. 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 `lapply` for details.

### Author(s)

Kylie A. Bemis

### See Also

`lapply`

### Examples

    register(SerialParam())

    x <- matter_list(list(1:10, b=11:20, 21:30), names=c("a", "b", "c"))

    lapply(x, sum)

    sapply(x, sum)

[Package matter version 1.13.8 Index]