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

853

Version

2.1.6

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Eliot J B

Last Published

September 2nd, 2025

Functions in SpaDES.core (2.1.6)

.checkCacheRepo,list-method

.checkCacheRepo for simList objects
.cacheMessage,simList-method

.cacheMessage for simList objects
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
checkModulePath

Check module path
checkModuleLocal

Check for the existence of a module locally
append_attr

Append attributes
bindrows

Simple wrapper around data.table::rbindlist
checkParams

Check use and existence of parameters passed to simulation.
checkpointFile

Simulation checkpoints
defineEvent

Alternative way to define events in SpaDES.core
citation

A citation method for SpaDES modules
createsOutput

Define an output object of a module
classFilter

Filter objects by class
.wrap.simList

Methods for .wrap and .unwrap
.coreModules

Named list of core SpaDES modules
checksums

Calculate checksum for a module's data files
convertToPackage

Convert standard module code into an R package
copyModule

Create a copy of an existing module
clearCache,simList-method

clearCache for simList objects
zipSimList

Zip a simList and various files
depsEdgeList

Build edge list for module dependency graph
.depsPruneEdges

Prune edges to remove cycles in module dependencies
defineModule

Define a new module.
defineParameter

Define a parameter used in a module
.cleanPkgs

strip GitHub repo info from vector of packages
doEvent

Process a simulation event
.findObjects

Find objects if passed as character strings
downloadData

Download module data
extractURL

Extract a url from module metadata
.emptyMetadata

Default (empty) metadata
depsGraph

Build a module dependency graph
downloadModule

Download a module from a SpaDES module GitHub repository
eventDiagram

Simulation event diagram
expectsInput

Define an input object that the module expects.
.depsLoadOrder

Determine module load order
emptyEventList

Blank (template) event list
.fileEdit

Open a file for editing
.findModuleName

Identify module names up to a given recursive level
fileName

Extract filename (without extension) of a file
.guessPkgFun

Guess package of a function
.knownDotParams

Reserved module parameter names
.getModuleInputObjects

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

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

Find simList in a nested list
.fillInputRows

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

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

ganttStatus
.fileExtensions

File extensions map
initialize,simList-method

Generate a simList object
globals

Get and set global simulation parameters
.findElementsInEnv

Find all references to sim$
loadSimList

Load a saved simList and ancillary files
.fileTableIn

Create empty fileTable for inputs and outputs
moduleDiagram

Simulation module dependency diagram
._inputObjectsDF

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

Check is module uses module namespacing
.getOption

A slightly modified version of getOption()
.identifyChildModules

Identify child modules from a recursive list
.keepAttrs

Attach missing attributes from x to y
minTimeunit

Determine the smallest timeunit in a simulation
maxTimeunit

Determine the largest timestep unit in a simulation
moduleCodeFiles

Extract the full file paths for R source code
makeMemoisable.simList

Make simList correctly work with memoise
memoryUseThisSession

Estimate memory used with system("ps")
.moduleDeps-class

The .moduleDeps class
.modifySearchPath

Modify package order in search path
getMapPath

Get copies of sample files for examples and tests
moduleCoverage

Calculate module coverage of unit tests
newProjectCode

Create new module code file
moduleParams

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

Defaults values used in defineModule
newModuleTests

Create template testing structures for new modules
newModule

Create new module from template
newProject

Create new SpaDES project
moduleVersion

Parse and extract a module's version
noEventWarning

Text for no event with that name
moduleGraph

Build a module dependency graph
moduleMetadata

Parse and extract module metadata
.callingModuleName

Namespacing within SpaDES
openModules

Open all modules nested within a base directory
objSize.simList

Object size for simList
packages

Get module or simulation package dependencies
objectDiagram

Simulation object dependency diagram
objectSynonyms

Identify synonyms in a simList
.parseElems,simList-method

.parseElems for simList class objects
.parseMessage

Prepend module name to a message
objs

Extract or replace an object from the simulation environment
params

Get and set simulation parameters
paramCheckOtherMods

Test and update a parameter against same parameter in other modules
.prepareOutput,simList-method

.prepareOutput for simList objects
.parseModulePartial

Parse and initialize a module
.preDigestByClass,simList-method

Pre-digesting method for simList
priority

Event priority
progressInterval

Get and set simulation progress bar details
rasterToMemory

Read raster to memory
rasterCreate

Simple wrapper to load any Raster* object
.quickCheck

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

Progress bar
.pkgEnv

The SpaDES.core package environment
.runCodeChecks

Runs a series of code checks during simInit()
remoteFileSize

Determine the size of a remotely hosted file
restartR

Restart R programmatically
reexports

Objects exported from other packages
saveFiles

Save objects using .saveObjects in params slot of simInit
.rndstr

Generate random strings
.robustDigest,simList-method

.robustDigest for simList objects
restartSpades

Restart an interrupted simulation
saveSimList

Save a whole simList object to disk
.runModuleInputObjects

Run module's .inputObjects
show,simList-method

Show an Object
savedSimEnv

Retrieve environment for saving interrupted simulations
simFile

Generate simulation file name
.simDeps-class

The .simDeps class
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.
scheduleConditionalEvent

Schedule a conditional simulation event
simInit

Initialize a new simulation
.sim2gantt

sim2gantt
setPaths

Get and set default working directories
newObjectsCreated

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

Simulation modules and dependencies
inputs

Simulation inputs
inputObjects

Metadata accessors
events

Simulation event lists
simList-class

The simList class
paths

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

Simulation environment
outputs

Simulation outputs
times

Time usage in SpaDES
.unparsed

Determine which modules in a list are unparsed
[,simList,character,ANY-method

Extract an intact simList but with subset of objects
suppliedElsewhere

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

Classes defined in SpaDES
inSeconds

Convert time units
.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.
.tryCatch

tryCatch that keeps warnings, errors and value (result)
dhour

SpaDES time units
spadesOptions

SpaDES.core options
updateList

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

Write RNG state info to file
writeEventInfo

Write simulation event info to file
zipModule

Create a zip archive of a module subdirectory
use_gha

Use GitHub actions for automated module checking
.verb

Chose verb conjugation for "to be"
Copy,simList-method

Copy for simList class objects
.addChangedAttr,simList-method

.addChangedAttr for simList objects
.addTagsToOutput,simList-method

.addTagsToOutput for simList objects
.addDepends

Add simulation dependencies
all.equal.simList

All equal method for simList objects
anyPlotting

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

Plot method for simList objects
Plots

Plot wrapper intended for use in a SpaDES module
SpaDES.core-package

Categorized overview of the SpaDES.core package
FilterRecursive

Recursively Filter a list