selectPar.pplyFun: Select an appropriate *pply function

View source: R/helpers.R

selectPar.pplyFunR Documentation

Select an appropriate *pply function

Description

Selects an appropriate *pply function depending on the parallel choice

Usage

selectPar.pplyFun(
  parallel.pars,
  .pplyFUN = c("apply", "lapply", "sapply", "mapply")
)

Arguments

parallel.pars

The output from parallelCheck, passing the parallelization options.

.pplyFUN

*pply function to be used. Current options are "apply", "lapply", "sapply" and "mapply".

Details

The output function will be either parallel::parLapply or lapply for .pplyFUN = "lapply", depending of whether parallelization is enabled or not. Same for apply and parallel::parApply and so on.

Value

A function

Warning

From the makeCluster help: “It is good practice to shut down the workers by calling stopCluster”. It is therefore recommended the following line of code after using this function: on.exit(parallel::stopCluster(parallel.pars$cl))

Author(s)

J. Bedia

See Also

Other parallel.helpers: parallelCheck()


SantanderMetGroup/transformeR documentation built on Aug. 29, 2024, 6:42 a.m.