Learn R Programming

parallelMap (version 1.1)

parallelMap: Maps a function over lists or vectors in parallel.

Description

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.

Usage

parallelMap(fun, ..., more.args = list(), simplify = FALSE,
  use.names = FALSE, impute.error = NULL, level = as.character(NA),
  show.info = NA)

Arguments

fun
[function] Function to map over ....
...
[any] Arguments to vectorize over (list or vector).
more.args
[list] A list of other arguments passed to fun. Default is empty list.
simplify
[logical(1)] Should the result be simplified? See sapply. Default is FALSE.
use.names
[logical(1)] Should result be named by first vector if that is of class character? Default is FALSE.
impute.error
[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 ter
level
[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. De
show.info
[logical(1)] Verbose output on console? Can be used to override setting from options / parallelStart. Default is NA which means no overriding.

Value

  • Result.

Examples

Run this code
parallelStart()
parallelMap(identity, 1:2)
parallelStop()

Run the code above in your browser using DataLab