Learn R Programming

SpaDES.core

Core functionality for Spatial Discrete Event System (SpaDES).

This package provides the core framework for a discrete event system to implement a complete data-to-decisions, reproducible workflow (e.g., McIntire et al. (2022) https://doi.org/10.1111/ele.13994, Barros et al. (2022) https://doi.org/10.1111/2041-210X.14034). The core components facilitate the development of modular pieces, and enable the user to include additional functionality by running user-built modules. Includes conditional scheduling, restart after interruption, packaging of reusable modules, tools for developing arbitrary automated workflows, automated interweaving of modules of different temporal resolution, and tools for visualizing and understanding the within-project dependencies. The suggested package NLMR can be installed from the repository (https://PredictiveEcology.r-universe.dev).

Website: https://SpaDES-core.PredictiveEcology.org

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

Installation

Current stable release

Install from CRAN:

install.packages("SpaDES.core")

Install from GitHub:

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

Development version (unstable)

Install from GitHub:

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

Contributions

Please see CONTRIBUTING.md for information on how to contribute to this project.

Copy Link

Version

Install

install.packages('SpaDES.core')

Monthly Downloads

470

Version

3.0.4

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Eliot J B

Last Published

January 11th, 2026

Functions in SpaDES.core (3.0.4)

checkpointFile

Simulation checkpoints
.checkCacheRepo,list-method

.checkCacheRepo for simList objects
.cacheMessage,simList-method

.cacheMessage for simList objects
checkModule

Check for the existence of a remote module
checkModulePath

Check module path
checkModuleLocal

Check for the existence of a module locally
checkParams

Check use and existence of parameters passed to simulation.
bindrows

Simple wrapper around data.table::rbindlist
append_attr

Append attributes
checkObject

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

Convert standard module code into an R package
checksums

Calculate checksum for a module's data files
.coreModules

Named list of core SpaDES modules
convertToPackage

Convert standard module code into an R package
clearCache,simList-method

clearCache for simList objects
citation

A citation method for SpaDES modules
classFilter

Filter objects by class
createsOutput

Define an output object of a module
clearCacheEventsOnly

Convenience wrapper around clearCache for SpaDES events
copyModule

Create a copy of an existing module
.depsPruneEdges

Prune edges to remove cycles in module dependencies
depsEdgeList

Build edge list for module dependency graph
defineParameter

Define a parameter used in a module
defineEvent

Alternative way to define events in SpaDES.core
zipSimList

Zip a simList and various files
depsGraph

Build a module dependency graph
doCallSafe

Memory safe alternative to do.call
.depsLoadOrder

Determine module load order
.findObjects

Find objects if passed as character strings
downloadData

Download module data
eventDiagram

Simulation event diagram
.knownDotParams

Reserved module parameter names
.guessPkgFun

Guess package of a function
downloadModule

Download a module from a SpaDES module GitHub repository
.emptyMetadata

Default (empty) metadata
emptyEventList

Blank (template) event list
defineModule

Define a new module.
.wrap.simList

Methods for .wrap and .unwrap
.fillOutputRows

An internal function for coercing a data.frame to outputs()
fileName

Extract filename (without extension) of a file
expectsInput

Define an input object that the module expects.
.findElementsInEnv

Find all references to sim$
doEvent

Process a simulation event
getMapPath

Get copies of sample files for examples and tests
extractURL

Extract a url from module metadata
.findSimList

Find simList in a nested list
globals

Get and set global simulation parameters
initialize,simList-method

Generate a simList object
.fileTableIn

Create empty fileTable for inputs and outputs
maxTimeunit

Determine the largest timestep unit in a simulation
getModuleVersion

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

Check is module uses module namespacing
._inputObjectsDF

Create an empty data.frame object for use with inputObjects or outputObjects
.getModuleInputObjects

Extract the user-defined .inputObjects function from a module
.findModuleName

Identify module names up to a given recursive level
.getOption

A slightly modified version of getOption()
.identifyChildModules

Identify child modules from a recursive list
.fillInputRows

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

strip GitHub repo info from vector of packages
.fileEdit

Open a file for editing
ganttStatus

ganttStatus
memoryUseThisSession

Estimate memory used with system("ps")
.keepAttrs

Attach missing attributes from x to y
.fileExtensions

File extensions map
moduleCodeFiles

Extract the full file paths for R source code
minTimeunit

Determine the smallest timeunit in a simulation
moduleVersion

Parse and extract a module's version
moduleCoverage

Calculate module coverage of unit tests
.modifySearchPath

Modify package order in search path
.callingModuleName

Namespacing within SpaDES
moduleDefaults

Defaults values used in defineModule
.moduleDeps-class

The .moduleDeps class
noEventWarning

Text for no event with that name
moduleDiagram

Simulation module dependency diagram
loadSimList

Load a saved simList and ancillary files
moduleGraph

Build a module dependency graph
makeMemoisable.simList

Make simList correctly work with memoise
moduleParams

Extract a module's parameters, inputs, or outputs
newProject

Create new SpaDES project
newModule

Create new module from template
newModuleTests

Create template testing structures for new modules
moduleMetadata

Parse and extract module metadata
objectDiagram

Simulation object dependency diagram
objs

Extract or replace an object from the simulation environment
openModules

Open all modules nested within a base directory
packages

Get module or simulation package dependencies
.prepareOutput,simList-method

.prepareOutput for simList objects
paramCheckOtherMods

Test and update a parameter against same parameter in other modules
progressInterval

Get and set simulation progress bar details
objectSynonyms

Identify synonyms in a simList
newProgressBar

Progress bar
newProjectCode

Create new module code file
.pkgEnv

The SpaDES.core package environment
.preDigestByClass,simList-method

Pre-digesting method for simList
params

Get and set simulation parameters
.parseElems,simList-method

.parseElems for simList class objects
priority

Event priority
.quickCheck

The SpaDES.core variable to switch between quick and robust checking
.rndstr

Generate random strings
restartSpades

Restart an interrupted simulation
remoteFileSize

Determine the size of a remotely hosted file
rasterToMemory

Read raster to memory
objSize.simList

Object size for simList
.robustDigest,simList-method

.robustDigest for simList objects
.parseModulePartial

Parse and initialize a module
.parseMessage

Prepend module name to a message
reexports

Objects exported from other packages
rasterCreate

Simple wrapper to load any Raster* object
saveSimList

Save a whole simList object to disk
restartR

Restart R programmatically
setPaths

Get and set default working directories
.runCodeChecks

Runs a series of code checks during simInit()
.simDeps-class

The .simDeps class
show,simList-method

Show an Object
saveFiles

Save objects using .saveObjects in params slot of simInit
savedSimEnv

Retrieve environment for saving interrupted simulations
.runModuleInputObjects

Run module's .inputObjects
.sim2gantt

sim2gantt
scheduleConditionalEvent

Schedule a conditional simulation event
scheduleEvent

Schedule a simulation event
simInitAndSpades2

simInitAndSpades2 is a convenience wrapper for do.call(simInitAndSpades, listOfArgs), i.e., a user can pass a list of all the arguments.
events

Simulation event lists
newObjectsCreated

Show which objects were first created in a simInit or spades call
simFile

Generate simulation file name
envir

Simulation environment
modules

Simulation modules and dependencies
outputs

Simulation outputs
inputObjects

Metadata accessors
simInit

Initialize a new simulation
inputs

Simulation inputs
.tagsByClass,simList-method

.tagsByClass for simList objects
spades2

spades2 is a convenience wrapper for do.call(spades, listOfArgs), i.e., a user can pass a list of all the arguments.
suppliedElsewhere

Assess whether an object has or will be supplied from elsewhere
spadesOptions

SpaDES.core options
simList-class

The simList class
dhour

SpaDES time units
times

Time usage in SpaDES
spadesClasses

Classes defined in SpaDES
[,simList,character,ANY-method

Extract an intact simList but with subset of objects
paths

Specify paths for modules, inputs, outputs, and temporary rasters
use_gha

Use GitHub actions for automated module checking
writeEventInfo

Write simulation event info to file
.unparsed

Determine which modules in a list are unparsed
.tryCatch

tryCatch that keeps warnings, errors and value (result)
.verb

Chose verb conjugation for "to be"
zipModule

Create a zip archive of a module subdirectory
updateList

Update elements of a named list with elements of a second named list
writeRNGInfo

Write RNG state info to file
inSeconds

Convert time units
Copy,simList-method

Copy for simList class objects
all.equal.simList

All equal method for simList objects
SpaDES.core-package

Categorized overview of the SpaDES.core package
anyPlotting

Test whether there should be any plotting from .plots module parameter
Plot,simList-method

Plot method for simList objects
.addDepends

Add simulation dependencies
.addTagsToOutput,simList-method

.addTagsToOutput for simList objects
Plots

Plot wrapper intended for use in a SpaDES module
.addChangedAttr,simList-method

.addChangedAttr for simList objects
FilterRecursive

Recursively Filter a list