preplicate: Parallel Implementation of replicate.

View source: R/parallel_replicate.R

preplicateR Documentation

Parallel Implementation of replicate.

Description

Implements parallel version of replicate using parallel::mclapply().

Usage

preplicate(n, expr, simplify = "array", ...)

Arguments

n

integer: the number of replications.

expr

the expression (a language object, usually a call) to evaluate repeatedly.

simplify

logical or character string, see replicate.

...

other arguments to be passed to mclapply.

Value

A list, vector, or matrix depending on arguments to simplify. See documentation for replicate for more details.

Author(s)

matthewwolak@gmail.com

Examples

## Not run: 
  system.time(r <- replicate(10000, var(rnorm(500))))
  system.time(pr <- preplicate(10000, var(rnorm(500)), mc.cores = 3))

## End(Not run)

matthewwolak/wolakR documentation built on May 10, 2023, 1:27 p.m.