Core Utilities for Developing and Running Spatially Explicit Discrete Event Simulation Models

Provide the core discrete event simulation (DES) framework for implementing spatially explicit simulation models. The core DES components facilitate modularity, and easily enable the user to include additional functionality by running user-built simulation modules.

Build Status Appveyor Build status Coverage Status CRAN_Status_Badge Downloads

Core functionality for Spatial Discrete Event Simulation (SpaDES)




Current stable release

Install from CRAN:


Install from GitHub:

install_github("PredictiveEcology/SpaDES.core", dependencies = TRUE) # stable

Development version (unstable)

Install from GitHub:

install_github("PredictiveEcology/SpaDES.core", ref = "development", dependencies = TRUE) # unstable


Known issues:

version 0.1.1

  • uses reproducible::Require instead of SpaDES.core::loadPackages to load required packages. Currently, does not use version control for packages, but does use installing (from CRAN or GitHub), and loading (via require). This means a module can indicate a github package, e.g,. achubaty/[email protected]

  • environments in modules are now as follows:

    • Functions defined in a module are sourced into an environment located here: [email protected]$<moduleName>, and it is a is a child of [email protected]. Functions can be found in this environment, but prefixing functions is not necessary, because modules functions are within this environment already.
    • [email protected] is a child of SpaDES.core
  • scoping from within a function that is defined in a module is thus:

  • speed improvements:

    • the core DES is now built around lists, rather than data.table. For small objects (e.g., the eventQueue) that have fewer than 200 objects, lists are faster. Accessors (e.g., events(sim), completed(sim)) of the event queues still show data.table objects, but these are made on the fly.
    • .parseModule and .parseModuePartial now put their parsed content into a temporary environment ([email protected]$.parsedFiles$<Full Filename>) during the simInit, which gets re-used. Previously, files were parsed multiple times in a given simInit call. Several functions now have envir argument to pass this through (including moduleVersion, packages, checkParams)
  • parsing of modules is now more intelligent, allowing for modules to contain functions (the current norm) and but they can also create objects at the module level. These can use the sim object in their definition. These objects can, for example, be used to help define parameters, for example, e.g., startSimPlus1 <- start(sim) + 1 can be defined in the module and used in defineModule

  • remove grDevices from Imports as it was not used (#1)

  • remove chron and CircStats dependencies

  • remove functions dwrpnorm2 and move to package

  • remove unused function F() due to conflicts with F/FALSE.

  • improved download of module data: added new quickCheck argument

  • improved download of modules: use fuzzy matching

  • new option: spades.switchPkgNamespaces which allows the user to turn off the SpaDES feature that loads and unloads libraries specific to each module. While useful, it slows down computations, in some cases, by a lot.

  • bug fixes:

    • in zipModule that omitted the checksum file from being included when data = FALSE (#3)
    • caching of .inputObjects functions was evaluating outputObjects instead of inputObjects. Now corrected.
  • If .inputObjects contains arguments other than just sim, these will be evaluated as function inputs by the Cache mechanism (via .useCache), therefore correctly assessing when those inputs changed, e.g., if they are files and the arg is wrapped in asPath, then any change to the underlying file will cause a re-cache. e.g., .inputObjects <- function(sim, importantFile = asPath(file.path(inputPath(sim), "theFile.rdata"))) { ... }

  • default debug option in spades() now uses the package option spades.debug and default is set to FALSE (#5)

  • various other speed improvements and bug fixes

  • convert P to a function, rather than S4 generic and method, for speed.

  • importFrom only used functions from utils due to name conflicts with raster::stack and utils::stack

  • new function remoteFileSize to check the size of remote files

  • new namespaced function dataPath will return file.path(modulePath(sim), currentModule(sim), "data"), which will return a different path, depending on which module it is placed inside.

  • add crayon to imports -- now messages are more colour coded

  • bug fix in 'inputs' for the case of loading objects from the global environment, either from the same object to the same object, or from different global objects overwriting on the same simList object

version 0.1.0

  • A new package, which takes all core DES functionality out of the SpaDES package:

    • see ?SpaDES.core for an overview
  • various speed improvements and bug fixes

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.1.1 by Alex M Chubaty, 23 days ago,

Report a bug at

Browse source code at

Authors: Alex M Chubaty [aut, cre], Eliot J B McIntire [aut], Yong Luo [ctb], Steve Cumming [ctb], Her Majesty the Queen in Right of Canada, as represented by the Minister of Natural Resources Canada [cph]

Documentation:   PDF Manual  

GPL-3 license

Imports crayon, data.table, DEoptim, DiagrammeR, digest, dplyr, fastdigest, fpCompare, httr, igraph, lubridate, methods, parallel, R.utils, raster, RCurl, stats, sp, stringi, tcltk, utils

Depends on quickPlot, reproducible

Suggests covr, hunspell, knitr, Matrix, png, RColorBrewer, rgdal, rgenoud, rmarkdown,, testthat

Imported by SpaDES, SpaDES.addins.

Suggested by NetLogoR.

See at CRAN