Skip to contents

Some computations take considerable amount of time to execute. This function provides a helper wrapper for running functions of the apply family to specified outputs.

Usage

run_parallel(
  X,
  FUN,
  cores = 1,
  approach = "future",
  export_packages = NULL,
  ...
)

Arguments

X

A list, data.frame or matrix object to be fed to a single core or parallel apply call.

FUN

A function passed on for computation.

cores

A numeric of the number of cores to use (Default: 1).

approach

character for the parallelization approach taken (Options: "parallel" or "future").

export_packages

A vector with packages to export for use on parallel nodes (Default: NULL).

...

Any other parameter passed on.

Value

A list with one result per element or row in X.

Details

By default, the parallel package is used for parallel computation, however an option exists to use the future package instead.

Examples

run_parallel(list(1:3, 4:6), mean, cores = 1)
#> The run_parallel function is likely deprecated and is only kept for reference...
#> [[1]]
#> [1] 2
#> 
#> [[2]]
#> [1] 5
#>