Learn R Programming

canprot (version 0.1.2)

lapply_canprot: Parallel Computation

Description

Set up and run parallel computations.

Usage

lapply_canprot(X, FUN, ..., varlist = NULL, min.length = 10)

Arguments

X

vector (atomic or list)

FUN

function or character string naming a function

...

additional arguments to pass to <U+2018>FUN<U+2019>

varlist

character, names of variables to export

min.length

numeric, minimum length of X for running parallel computations

Details

If length(X) is less than min.length, this function simply calls lapply given the X, FUN and ... arguments, and returns the result. Otherwise, a cluster is initiatied by loading CHNOSZ and canprot and setting up the respective data environments (thermo and canprot). If varlist is supplied, the named variables are exported to the global environment of each node in the cluster using clusterExport. Then, parallel computations in the cluster are run using parLapply given the X, FUN and ... arguments.

For examples, see the data vignettes and the help for pdat_.