par.replicate: par.replicate

Description Usage Arguments Examples

View source: R/par.replicate.R

Description

wrapper fo parSapply to mimic replicate in base R for parallel

Usage

1
par.replicate(cl, n, expr, simplify = FALSE)

Arguments

cl

cluster connections from parallel::makeCluster

n

number of replicates, or number of simulations

expr

expression or function to use in replicate

simplify

wrapper to simplify within parSapply, usually FALSE

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(parallel) 
cl <- makeCluster(2) 
clusterEvalQ(cl,  { library(MASS)
library(magrittr)
library(dplyr)
library(lme4)
library(rstan)
library(rstanarm)
})
clusterExport(cl=cl, varlist=c("sim_dauer_3G_stan", "settings"))
simulation <- do.call( rbind, par.replicate(cl,n=1000, 
sim_dauer_3G_stan(c(settings,
do.plot = FALSE, 
do.stan = TRUE)), 
simplify=FALSE ))

mikeod38/dauergut documentation built on April 26, 2018, 4:15 p.m.