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-class'
Exercises 03, numbers 2 & 3.
| slot | accessor |
|---|---|
| .envir | envir() |
| modules | modules() |
| params | params() |
| events | events() |
| current | current() |
| completed | completed() |
| depends | depends() |
| simtimes | times() |
| inputs | inputs() |
| outputs | outputs() |
| paths | paths() |
| other_accessors |
|---|
| packages() |
| globals() |
| start() |
| end() |
| timeunit() |
| timeunits() |
| objects() |
| paths() |
| cachePath() |
| inputPath() |
| outputPath() |
| modulePath() |
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 and its data:
module.path <- file.path(dirname(tempdir()), "modules")
downloadModule('wolfAlps', module.path, data = FALSE)
downloadData('wolfAlps', module.path)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 directorymake a copy of the module you wish to modify
edit away!
Building SpaDES modules from scratch (slides).