Description Usage Arguments Value Implementation Author(s) See Also
A simple parallel clone of replicate; this function is a wrapper for mclapply just like replicate is a wrapper for sapply.
1 | RepParallel(n, expr, simplify = "array",...)
|
n |
An integer giving the number of replications to execute. |
expr |
R code to execute. |
simplify |
logical or character string; should the result be simplified to a vector, matrix or higher dimensional array if possible? |
... |
Optional arguments to mclapply. |
Just as in replicate.
1 2 3 4 5 6 7 8 | <<*>>=
RepParallel <- function(n, expr, simplify = "array",...) {
answer <-
mclapply(integer(n), eval.parent(substitute(function(...) expr)),...)
if (!identical(simplify, FALSE) && length(answer))
return(simplify2array(answer, higher = (simplify == "array")))
else return(answer)
}
|
Gray Calhoun gcalhoun@iastate.edu
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.