Learn R Programming

BBmisc (version 1.1-125)

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

Description

Use the parallelization mode and the other options set in parallelStart. For multicore mclapply is used, for snowfall sfClusterApplyLB.

Usage

parallelMap(fun, ..., more.args = list(),
    simplify = FALSE, use.names = FALSE,
    level = as.character(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 or integer? Default is FALSE.
level
[character(1)] The call is only parallelized if the same level is specified in parallelStart or this argument is NA. Default is NA.

Value

  • Result.

Details

Currently some options for more efficient exporting of arguments to slaves for snowfall are missing, will be included in next version.

Examples

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

Run the code above in your browser using DataLab