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") # stable

Development version (unstable)

Install from GitHub:

#install.packages("devtools")
library("devtools")
install_github("PredictiveEcology/SpaDES", ref = "development") # 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

318

Version

1.2.0

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

June 24th, 2016

Functions in SpaDES (1.2.0)

append_attr

Add a module to a moduleList
checkModule

Check for the existence of a remote module
.addDepends

Add simulation dependencies
adj.raw

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

Check for existence of object(s) referenced by a objects slot of a simList object
.arrangement-class

The .arrangement class
cache

Cache method for simList class objects
.arrangeViewports

Determine optimal plotting arrangement of plot objects
.assignSpaDES

Assign to the internal SpaDES environment.
changeObjEnv

Copy or move objects from one environment to another
classFilter

Filter objects by class
cir

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

Clear plotting device
doEvent.checkpoint

Simulation checkpoints.
checksums

Calculate checksums for a module's data files
clearStubArtifacts

Clear erroneous archivist artifacts
checkPath

Check filepath.
checkParams

Check use and existence of params passed to simulation.
defineModule

Define a new module.
defineParameter

Define a parameter used in a module
equalExtent

Assess whether a list of extents are all equal
.emptyMetadata

Default (empty) metadata
.findFactors

Find factors
getColors

Get colours for plotting Raster* objects.
findObjects

Find objects if passed as character strings
ganttStatus

ganttStatus
dwrpnorm2

Vectorized wrapped normal density function
.emptyEventList

Blank (template) event list
gaussMap

Produce a raster of a random Gaussian process.
getModuleVersion

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

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

Get simulation package dependencies
.getSpaDES

Get objects from the internal SpaDES environment
paddedFloatToChar

Convert numeric to character with padding
makeDigestible

Remove any reference to environments in a simList
rasterizeReduced

Convert reduced representation to full raster
rings

Identifies all cells within a ring around the focal cells
rndstr

Generate random strings
rasterToMemory

Read raster to memory
simList_-class

The simList_ class
envir

Simulation environment
params

Get and set simulation parameters.
dev

Specify where to plot
paths

Specify paths for modules, inputs, and outputs
digest

Calculate the hashes of multiple files
downloadModule

Download a module from a SpaDES module GitHub repository
downloadData

Download module data
.makeViewports

Make viewports
makeLines

Make SpatialLines object from two SpatialPoints objects
.makeLayout

Make an optimal layout of plots
maxTimeunit

Determine the largest timestep unit in a simulation
.spadesPlot-class

The .spadesPlot class
.spadesPlotObjects-class

The .spadesPlotObjects class
copy

Copy a simList object
depsEdgeList

Build edge list for module dependency graph
move

Move
depsGraph

Build a module dependency graph
eventDiagram

Simulation event diagram
.existsSpaDES

Is an object defined in the .spades environment?
getFileName

Get the name of a source-ed file
ls.simList

List simulation objects
moduleDiagram

Simulation module dependency diagram
ls.str.simList

List simulation objects and their structure
moduleMetadata

Parse and extract module metadata
.first

Event priority
directionFromEachPoint

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

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

Divergent colour palette
gpar

Importing some grid functions
fileName

Extract filename (without extension) of a file
.fileTableIn

Create empty fileTable for inputs and outputs
doEvent

Process a simulation event
heading

Heading between spatial points.
.fileExtensions

File extensions map
loadPackages

Load packages.
normPath

Normalize filepath
patchSize

Patch size
objectDiagram

Simulation object dependency diagram
objs

Extract or replace an object from the simulation environment
modules

Simulation modules and dependencies
Plot

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

Convert plotArgs to list of lists
.makeSpadesPlot

Make a .spadesPlot class object
newModule

Create new module from template.
newPlot

Open a new plotting window
shine

Display a simple, interactive shiny app of the simList
setColors<-

Set colours for plotting Raster* objects.
sortDotsFirst

Sort a any named object with dotted names first
spadesClasses

Classes defined in SpaDES
spread

Simulate a spread process on a landscape.
splitRaster

Split a RasterLayer into multiple tiles
randomPolygons

randomPolygons
agentLocation

SELES - Agent Location at initiation
currentModule,.simList-method

Simulation event lists
numAgents

SELES - Number of Agents to initiate
inputs

Inputs and outputs
.spadesEnv

The SpaDES environment
.spadesGrob-class

The .spadesGrob class
spatialObjects-class

The spatialObjects class
specificNumPerPatch

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

Determine which modules in a list are unparsed
updateList

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

Determine module load order
experiment

.identifyGrobToPlot

Identify where to get the grob from
.depsPruneEdges

Prune edges to remove cycles in module dependencies
fileExt

Extract the file extension of a file
initialize,simList-method

Generate a simList object
moduleCoverage

Calculate module coverage of unit tests
.moduleDeps-class

The .moduleDeps class
.simList-class

The simList class
times

Time usage in SpaDES
.spadesPlottables-class

The .spadesPlottables class
dyears

SpaDES time units
wrap

Wrap coordinates or pixels in a torus-like fashion
zipModule

Create a zip archive of a module subdirectory
.fillInputRows

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

SELES - Initiate agents
.fillOutputRows

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

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

Test whether a number lies within range [a,b]
layerNames

Extract the layer names of Spatial Objects
mergeRaster

Merge split raster tiles into a single raster layer.
minTimeunit

Determine the smallest timeunit in a simulation
objectNames

Extracts the object names
openModules

Open all modules nested within a base directory
.plotGrob

Plot spatial grobs (using grid package)
.prepareRaster

Prepare raster for plotting
saveFiles

Save objects using .saveObjects in params slot of simInit
scheduleEvent

Schedule a simulation event
show,simList-method

Show an Object
.sim2gantt

sim2gantt
newProgressBar

Progress bar
.parseArgs

Parse arguments and find environments
nlayers,list-method

Find the number of layers in a Spatial Object
.parseModule

Parse and initialize a module
transitions

SELES - Transitioning to next time step
probInit

SELES - Probability of Initiation
.simDeps-class

The .simDeps class
simInit

Initialize a new simulation
clickValues

Mouse interactions with Plots
spadesMaps

Dummy maps included with SpaDES
inSeconds

Convert time units
.unittrim

Convert grid.locator units
SpaDES-package

Categorized overview of the SpaDES package
spades

Run a spatial discrete event simulation
.updateSpadesPlot

Merge two SpaDES Plot objects
versionWarning

Compare module version against SpaDES package version and warn if incompatible