lapply_canprot {canprot}R Documentation

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 ‘FUN’

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.

Because of the overhead of loading packages and data, this function is most suitable for parallelizing “large” calculations. See ../doc/summary_table.html for an example.


[Package canprot version 0.0.2 Index]