parallelize_fun {thisutils} | R Documentation |
Parallelize a function
Description
Parallelize a function
Usage
parallelize_fun(x, fun, cores = 1, export_fun = NULL, verbose = TRUE)
Arguments
x |
A vector or list to apply over. |
fun |
The function to be applied to each element. |
cores |
The number of cores to use for parallelization with foreach::foreach.
Default is |
export_fun |
The functions to export the function to workers. |
verbose |
Logical value, default is |
Value
A list of computed results
Examples
parallelize_fun(1:3, function(x) {
Sys.sleep(0.2)
x^2
})
parallelize_fun(list(1, 2, 3), function(x) {
Sys.sleep(0.2)
x^2
}, cores = 2)
[Package thisutils version 0.0.7 Index]