knitr::opts_chunk$set(cache = TRUE, echo = TRUE, eval = FALSE) library(magrittr) library(SpaDES)
Initializing a simulation using simInit() creates a simList object.
Running a simulation via a spades() call returns a modified simList object.
A simList object is simply a structured data type containing various elements of a simulation.
The main components of a simList are:
SpaDES works: simListsWe can examine the simList object structure in the usual R fashion by printing (showing) it, or by using str():
emptySim <- simInit() emptySim # same as show(emptySim) str(emptySim)
NOTE: simLists are S4 objects, so we can use getSlots() and slotNames() to examine the object.
See also ?simList
Exercises 03, numbers 2 & 3.
SpaDES works: spades()Simple examples (using demo modules) of simInit() and spades() calls.
Exercises 03, number 4, 5, & 6.
spades() callBrowse for modules in our SpaDES module repository:
Download a module, its data, and required packages:
r
module.path <- file.path(dirname(tempdir()), "modules")
downloadModule('wolfAlps', module.path, data = FALSE)
downloadData('wolfAlps', module.path)
f <- file.path(module.path, 'wolfAlps', 'wolfAlps.R')
pkgs <- packages(filename = f)
install.packages(pkgs)
Important: always make a copy of the module you wish to modify before editing!
Open the module's code file in your editor:
openModules('wolfAlps', module.path) # opens only the named module openModules(path = module.path) # opens all modules in a directory
Building SpaDES modules from scratch (slides).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.