Parallel, optionally verbose lapply. See ?parallel::mclapply for more info.
plapply(
...,
progress = FALSE,
n.cores = parallel::detectCores(),
mc.preschedule = FALSE,
mc.allow.recursive = TRUE,
fail.on.error = FALSE
)
list, as returned by lapply
Additional arguments passed to mclapply(), lapply(), or pbmcapply::pbmclapply()
Show progress bar via pbmcapply::pbmclapply() (default=FALSE).
Number of cores to use (default=parallel::detectCores()). When n.cores=1, regular lapply() is used. Note: doesn't work when progress=TRUE
if set to TRUE
then the computation is
first divided to (at most) as many jobs are there are cores and then
the jobs are started, each job possibly covering more than one
value. If set to FALSE
then one job is forked for each value
of X
. The former is better for short computations or large
number of values in X
, the latter is better for jobs that
have high variance of completion time and not too many values of
X
compared to mc.cores
.
boolean Unless true, calling mclapply in a child process will use the child and not fork again (default=TRUE)
boolean Whether to fail and report and error (using stop()) as long as any of the individual tasks has failed (default =FALSE)
square = function(x){ x**2 }
plapply(1:10, square, n.cores=1, progress=TRUE)
Run the code above in your browser using DataLab