Spatial contagion is a key phenomenon for spatially explicit simulation models. Contagion can be modelled using discrete approaches or continuous approaches. Several functions assist with these:

 adj() An optimized (i.e., faster) version of raster::adjacent() cir() Identify pixels in a circle around a SpatialPoints*() object directionFromEachPoint() Fast calculation of direction and distance surfaces distanceFromEachPoint() Fast calculation of distance surfaces rings() Identify rings around focal cells (e.g., buffers and donuts) spokes() TO DO: need description spread() Contagious cellular automata wrap() Create a torus from a grid

## 2 Spatial agent methods

Agents have several methods and functions specific to them:

 crw() Simple correlated random walk function heading() Determines the heading between SpatialPoints* quickPlot::makeLines() Makes SpatialLines object for, e.g., drawing arrows move() A meta function that can currently only take "crw" specificNumPerPatch() Initiate a specific number of agents per patch

## 3 GIS operations

In addition to the vast amount of GIS operations available in R (mostly from contributed packages such as sp, raster, maps, maptools and many others), we provide the following GIS-related functions:

 equalExtent() Assess whether a list of extents are all equal

## 4 Map-reduce - type operations

These functions convert between reduced and mapped representations of the same data. This allows compact representation of, e.g., rasters that have many individual pixels that share identical information.

 rasterizeReduced() Convert reduced representation to full raster

## 5 Random Map Generation

It is often useful to build dummy maps with which to build simulation models before all data are available. These dummy maps can later be replaced with actual data maps.

 randomPolygons() Creates a random polygon with specified number of classes.

See the NLMR package for tools to generate random landscapes (rasters).

## 6 SELES-type approach to simulation

These functions are essentially skeletons and are not fully implemented. They are intended to make translations from SELES. You must know how to use SELES for these to be useful:

 agentLocation() Agent location initiateAgents() Initiate agents into a SpatialPointsDataFrame numAgents() Number of agents probInit() Probability of initiating an agent or event transitions() Transition probability

## 7 Package options

SpaDES packages use the following options() to configure behaviour:

• spades.lowMemory: If true, some functions will use more memory efficient (but slower) algorithms. Default FALSE.