Learn R Programming

mrgsim.parallel (version 0.3.0)

bg_mclapply: Multicore lapply in the background

Description

Multicore lapply in the background

Usage

bg_mclapply(X, FUN, mc.cores = 1, ..., .wait = TRUE, .seed = NULL)

Value

A list of output data.

Arguments

X

A list.

FUN

The function to be applied to each element of X.

mc.cores

Passed to parallel::mclapply().

...

Arguments passed to FUN.

.wait

If FALSE, the function returns immediately; if TRUE, then wait until the background job is finished.

.seed

A numeric value used to set the seed for the simulation; this is the only way to control the random number generation for your simulation.

Examples

Run this code
ans <- bg_mclapply(seq(10), sqrt, mc.cores = 2)

Run the code above in your browser using DataLab