Learn R Programming

⚠️There's a newer version (2.0.11) of this package.Take me there.

Spatial Discrete Event Simulation (SpaDES)

Develop and run spatially explicit discrete event simulation models

Easily implement a variety of simulation models, with a focus on spatially explicit models. These include raster-based, event-based, and agent-based models. The core simulation components are built upon a discrete event simulation framework that facilitates modularity, and easily enables the user to include additional functionality by running user-built simulation modules. Included are numerous tools to rapidly visualize raster and other maps.

Website: http://SpaDES.PredictiveEcology.org

Wiki: https://github.com/PredictiveEcology/SpaDES/wiki

Installation

Building packages from source requires the appropriate development libraries for your operating system (e.g., Windows users should install Rtools).

The suggested package fastshp can be installed with:

install.packages("fastshp", repos = "http://rforge.net", type = "source")

Current stable release

Install from CRAN:

install.packages("SpaDES")

Install from GitHub:

#install.packages("devtools")
library("devtools")
install_github("PredictiveEcology/SpaDES", dependencies = TRUE) # stable

Development version (unstable)

Install from GitHub:

#install.packages("devtools")
library("devtools")
install_github("PredictiveEcology/SpaDES", ref = "development", dependencies = TRUE) # unstable

Getting started

Vignettes:

Available via our wiki or via browseVignettes(package = "SpaDES").

Wiki:

https://github.com/PredictiveEcology/SpaDES/wiki

Q&A Forum:

https://groups.google.com/d/forum/spades-users

Reporting bugs

Contact us via the package GitHub site: https://github.com/PredictiveEcology/SpaDES/issues.


Copyright (C) 2016 Her Majesty the Queen in Right of Canada, as represented by the Minister of Natural Resources Canada

Copy Link

Version

Install

install.packages('SpaDES')

Monthly Downloads

484

Version

1.3.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Alex M Chubaty

Last Published

October 6th, 2016

Functions in SpaDES (1.3.0)

checkObject

Check for existence of object(s) referenced by a objects slot of a simList object
checkModule

Check for the existence of a remote module
cache

Cache method for simList class objects
adj.raw

Fast `adjacent` function, and Just In Time compiled version
changeObjEnv

Copy or move objects from one environment to another
append_attr

Add a module to a moduleList
addin_newModule

Rstudio addin to create a new module
.assignSpaDES

Assign to the internal SpaDES environment.
.arrangeViewports

Determine optimal plotting arrangement of plot objects
checkParams

Check use and existence of params passed to simulation.
checkPath

Check filepath.
cir

Identify pixels in a circle or ring (donut) around an object.
classFilter

Filter objects by class
copy

Copy a simList object
clearPlot

Clear plotting device
createsOutput

Define an output object of a module
clearStubArtifacts

Clear erroneous archivist artifacts
doEvent.checkpoint

Simulation checkpoints.
checksums

Calculate checksums for a module's data files
.depsLoadOrder

Determine module load order
depsGraph

Build a module dependency graph
dev

Specify where to plot
distanceFromEachPoint

Calculate distances and directions between many points and many grid cells
digest

Calculate the hashes of multiple files
directionFromEachPoint

Calculate distances and directions between many points and many grid cells
move

Move
depsEdgeList

Build edge list for module dependency graph
.depsPruneEdges

Prune edges to remove cycles in module dependencies
defineParameter

Define a parameter used in a module
eventDiagram

Simulation event diagram
.existsSpaDES

Is an object defined in the .spades environment?
downloadModule

Download a module from a SpaDES module GitHub repository
dwrpnorm2

Vectorized wrapped normal density function
downloadData

Download module data
.emptyEventList

Blank (template) event list
divergentColors

Divergent colour palette
doEvent

Process a simulation event
equalExtent

Assess whether a list of extents are all equal
.emptyMetadata

Default (empty) metadata
.fillInputRows

An internal function for coercing a data.frame to inputs()
.fileEdit

Open a file for editing
.fileTableIn

Create empty fileTable for inputs and outputs
.findFactors

Find factors
fileExt

Extract the file extension of a file
findObjects

Find objects if passed as character strings
fileName

Extract filename (without extension) of a file
expectsInput

Define an input object that the module expects.
experiment

.fillOutputRows

An internal function for coercing a data.frame to inputs()
heading

Heading between spatial points.
.identifyGrobToPlot

Identify where to get the grob from
.inputObjects

Create an empty (template) inputObjects and outputObjects data.frames
newModule

Create new module from template.
.makeSpadesPlot

Make a .spadesPlot class object
inRange

Test whether a number lies within range [a,b]
.makeViewports

Make viewports
newModuleCode

Create new module code file
maxTimeunit

Determine the largest timestep unit in a simulation
ls.simList

List simulation objects
.makeColorMatrix

Convert Raster to color matrix useable by raster function for plotting
mergeRaster

Merge split raster tiles into a single raster layer.
moduleGraph

Build a module dependency graph
moduleDiagram

Simulation module dependency diagram
objectDiagram

Simulation object dependency diagram
POM

Use Pattern Oriented Modeling to fit unknown parameters
objectNames

Extracts the object names
.prepareRaster

Prepare raster for plotting
.addDepends

Add simulation dependencies
gaussMap

Produce a raster of a random Gaussian process.
ganttStatus

ganttStatus
.paths

Default paths to use for a simulation
rasterToMemory

Read raster to memory
.convertSpatialToPlotGrob

Internal functions used by Plot
shine

Display a simple, interactive shiny app of the simList
show,simList-method

Show an Object
rings

Identifies all cells within a ring around the focal cells
dyears

SpaDES time units
getColors

Get colours for plotting Raster* objects.
getFileName

Get the name of a source-ed file
loadPackages

Load packages.
ls.str.simList

List simulation objects and their structure
makeLines

Make SpatialLines object from two SpatialPoints objects
.makeList

Convert plotArgs to list of lists
globals

Get and set simulation globals.
moduleMetadata

Parse and extract module metadata
.callingModuleName

Namespacing within SpaDES
gpar

Importing some grid functions
packages

Get simulation package dependencies
layerNames

Extract the layer names of Spatial Objects
.fileExtensions

File extensions map
makeDigestible

Remove any reference to environments in a simList
.makeLayout

Make an optimal layout of plots
newProgressBar

Progress bar
newPlot

Open a new plotting window
objs

Extract or replace an object from the simulation environment
openModules

Open all modules nested within a base directory
Plot

Plot: Fast, optimally arranged, multipanel plotting function with SpaDES
.plotGrob

Plot spatial grobs (using grid package)
rndstr

Generate random strings
saveFiles

Save objects using .saveObjects in params slot of simInit
events

Simulation event lists
spadesClasses

Classes defined in SpaDES
SpaDES-package

Categorized overview of the SpaDES package
inputs

Inputs and outputs
params

Get and set simulation parameters.
.parseArgs

Parse arguments and find environments
.parseModulePartial

Parse and initialize a module
patchSize

Patch size
rasterizeReduced

Convert reduced representation to full raster
randomPolygons

randomPolygons
.sim2gantt

sim2gantt
simInit

Initialize a new simulation
.first

Event priority
paddedFloatToChar

Convert numeric to character with padding
times

Time usage in SpaDES
sortDotsFirst

Sort a any named object with dotted names first
agentLocation

SELES - Agent Location at initiation
scheduleEvent

Schedule a simulation event
spades

Run a spatial discrete event simulation
progressInterval

Get and set simulation progress bar details
.spadesEnv

The SpaDES environment
splitRaster

Split a RasterLayer into multiple tiles
spokes

Identify outward radiating spokes from initial points
getModuleVersion

Find the latest module version from a SpaDES module repository
.getSpaDES

Get objects from the internal SpaDES environment
initialize,simList-method

Generate a simList object
minTimeunit

Determine the smallest timeunit in a simulation
initiateAgents

SELES - Initiate agents
moduleCoverage

Calculate module coverage of unit tests
newModuleDocumentation

Create new module documentation
normPath

Normalize filepath
newModuleTests

Create template testing structures for new modules
numLayers

Find the number of layers in a Spatial Object
.unittrim

Convert grid.locator units
specificNumPerPatch

Initiate a specific number of agents in a map of patches
.unparsed

Determine which modules in a list are unparsed
transitions

SELES - Transitioning to next time step
setColors<-

Set colours for plotting Raster* objects.
spadesMaps

Dummy maps included with SpaDES
clickValues

Mouse interactions with Plots
updateList

Update elements of a named list with elements of a second named list
.updateSpadesPlot

Merge two SpaDES Plot objects
spread

Simulate a spread process on a landscape.
inSeconds

Convert time units
zipModule

Create a zip archive of a module subdirectory
numAgents

SELES - Number of Agents to initiate
probInit

SELES - Probability of Initiation
simList_-class

The simList_ class
envir

Simulation environment
modules

Simulation modules and dependencies
paths

Specify paths for modules, inputs, and outputs
versionWarning

Compare module version against SpaDES package version and warn if incompatible
wrap

Wrap coordinates or pixels in a torus-like fashion