knitr::opts_chunk$set(cache = TRUE, echo = TRUE, eval = FALSE)
Often we want to run a simulation with a variety of parameter values as inputs. This is sometimes called a simulation experiment. The experiment
function gives us an easy interface to this.
We will use the establishment
module that we created in exercise 4a.
library(ggplot2) library(SpaDES) module.path <- file.path(dirname(tempdir()), "modules") downloadModule("establishment", path = module.path) setPaths(modulePath = module.path) modules <- list("establishment") mySim <- simInit(modules = modules) # make sure the plotting device is clear clearPlot() spades(mySim)
?experiment
, use experiment
to run a spades
call for each parameter set (note that experiment
is just a wrapper around spades
). attributes(mySim)
. sum(mySim$establish[])
, i.e., the number of pixels that had an establishment event. Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.