# NOT RUN {
# }
# NOT RUN {
Generate <- function(condition, fixed_objects = NULL) {
int <- sample(1:10, 1)
if(int > 5) warning('GENERATE WARNING: int greater than 5')
if(int == 1) stop('GENERATE WARNING: integer is 1')
rnorm(5)
}
Analyse <- function(condition, dat, fixed_objects = NULL) {
int <- sample(1:10, 1)
if(int > 5) warning('ANALYSE WARNING: int greater than 5')
if(int == 1) stop('ANALYSE WARNING: int is 1')
c(ret = 1)
}
Summarise <- function(condition, results, fixed_objects = NULL) {
mean(results)
}
res <- runSimulation(replications = 100, seed=1234, verbose=FALSE,
generate=Generate, analyse=Analyse, summarise=Summarise)
res
SimExtract(res, what = 'errors')
SimExtract(res, what = 'warnings')
seeds <- SimExtract(res, what = 'error_seeds')
seeds[,1:3]
# replicate a specific error for debugging (type Q to exit debugger)
res <- runSimulation(replications = 100, load_seed=seeds[,1], debug='analyse',
generate=Generate, analyse=Analyse, summarise=Summarise)
# }
Run the code above in your browser using DataLab