Maps a function over lists or vectors in parallel.

Uses the parallelization mode and the other options specified in parallelStart.

Libraries and source file can be initialized on slaves with parallelLibrary and parallelSource.

Large objects can be separately exported via parallelExport, they can be simply used under their exported name in slave body code.

Regarding errorhandling, see the argument impute.error.

parallelMap(fun, ..., more.args = list(), simplify = FALSE, use.names = FALSE, impute.error = NULL, level = NA_character_, = NA)
[function] Function to map over ....
[any] Arguments to vectorize over (list or vector).
[list] A list of other arguments passed to fun. Default is empty list.
[logical(1)] Should the result be simplified? See sapply. Default is FALSE.
[logical(1)] Should result be named by first vector if that is of class character? Default is FALSE.
[NULL | function(x)] This argument can be used for improved error handling. NULL means that, if an exception is generated on one of the slaves, it is also thrown on the master. Usually all slave jobs will have to terminate until this exception on the master can be thrown. If you pass a constant value or a function, all jobs are guaranteed to return a result object, without generating an exception on the master for slave errors. In case of an error, this is a simpleError object containing the error message. If you passed a constant object, the error-objects will be substituted with this object. If you passed a function, it will be used to operate on these error-objects (it will ONLY be applied to the error results). For example, using identity would keep and return the simpleError-object, or function(x) 99 would impute a constant value (which could be achieved more easily by simply passing 99). Default is NULL.
[character(1)] If a (non-missing) level is specified in parallelStart, this call is only parallelized if the level specified here matches. Useful if this function is used in a package. Default is NA.
[logical(1)] Verbose output on console? Can be used to override setting from options / parallelStart. Default is NA which means no overriding.


  • parallelMap
parallelMap(identity, 1:2)
Documentation reproduced from package parallelMap, version 1.3, License: BSD_2_clause + file LICENSE

Community examples

Looks like there are no examples yet.