Skip to contents

Lapply or bplapply.

Usage

loop(x, FUN, parallelize = TRUE, ...)

Arguments

x

Vector (atomic or list) or an ‘expression’ object. Other objects (including classed objects) will be coerced by ‘base::as.list’.

FUN

A user-defined function.

parallelize

Logical indicating whether or not to parallelize the computation. Defaults to TRUE.

...

optional argument passed to bplapply if parallelize == TRUE, else to lapply.

Value

List containing output of FUN applied to every element in x.

Examples

loop(list(c(1,2), c(2,3)), sum, parallelize = FALSE)
#> [[1]]
#> [1] 3
#> 
#> [[2]]
#> [1] 5
#>