parpblapply: Parallel lapply with progressbar

Description Usage Arguments Value Examples

View source: R/parallel3D.R

Description

Function detects the operating system and chooses the approximate kind of process for parallelizing the task: Windows: PSOCKCluster, Unix: Forking.

Usage

1
2
3
4
5
6
7
8
parpblapply(
  X,
  FUN,
  packages = NULL,
  export = NULL,
  envir = environment(),
  nNodes = parallel::detectCores() - 1
)

Arguments

X

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

FUN

function, the function to be applied to each element of X

packages

character vector, Only relevant for Windows: the packages needed in the function provided, eg. c("MASS", "data.table")

export

character vector, Only relevant for Windows: the varibales needed in the function provided, eg. c("df", "vec")

envir

environment, Only relevant for Windows: Environment from which the variables should be exported from

nNodes

numeric, Number of processes to start (unix: best to fit with the available Cores)

Value

A list with the results.

Examples

1
2
3
4
square <- function(x) {
  x * x
}
l <- parpblapply(X = 1:1000, FUN = square, export = c("square"), nNodes = 2)

munterfi/eRTG3D documentation built on Feb. 25, 2022, noon