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.8

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Eliot J B

Last Published

September 18th, 2025

Functions in SpaDES.core (2.1.8)

.addChangedAttr,simList-method

.addChangedAttr for simList objects
FilterRecursive

Recursively Filter a list
Plots

Plot wrapper intended for use in a SpaDES module
.addDepends

Add simulation dependencies
all.equal.simList

All equal method for simList objects
.addTagsToOutput,simList-method

.addTagsToOutput for simList objects
Plot,simList-method

Plot method for simList objects
Copy,simList-method

Copy for simList class objects
SpaDES.core-package

Categorized overview of the SpaDES.core package
anyPlotting

Test whether there should be any plotting from .plots module parameter
checkModulePath

Check module path
checkModule

Check for the existence of a remote module
checkModuleLocal

Check for the existence of a module locally
checkParams

Check use and existence of parameters passed to simulation.
.cacheMessage,simList-method

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

Simulation checkpoints
.checkCacheRepo,list-method

.checkCacheRepo for simList objects
checksums

Calculate checksum for a module's data files
.coreModules

Named list of core SpaDES modules
copyModule

Create a copy of an existing module
.wrap.simList

Methods for .wrap and .unwrap
classFilter

Filter objects by class
createsOutput

Define an output object of a module
defineEvent

Alternative way to define events in SpaDES.core
citation

A citation method for SpaDES modules
clearCache,simList-method

clearCache for simList objects
convertToPackage

Convert standard module code into an R package
defineParameter

Define a parameter used in a module
zipSimList

Zip a simList and various files
.cleanPkgs

strip GitHub repo info from vector of packages
defineModule

Define a new module.
depsEdgeList

Build edge list for module dependency graph
depsGraph

Build a module dependency graph
.findObjects

Find objects if passed as character strings
doEvent

Process a simulation event
.depsPruneEdges

Prune edges to remove cycles in module dependencies
.depsLoadOrder

Determine module load order
expectsInput

Define an input object that the module expects.
.emptyMetadata

Default (empty) metadata
downloadData

Download module data
eventDiagram

Simulation event diagram
.guessPkgFun

Guess package of a function
extractURL

Extract a url from module metadata
downloadModule

Download a module from a SpaDES module GitHub repository
.fileEdit

Open a file for editing
emptyEventList

Blank (template) event list
.knownDotParams

Reserved module parameter names
ganttStatus

ganttStatus
fileName

Extract filename (without extension) of a file
.findSimList

Find simList in a nested list
.fillOutputRows

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

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

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

Create empty fileTable for inputs and outputs
.getModuleInputObjects

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

Identify module names up to a given recursive level
.findElementsInEnv

Find all references to sim$
globals

Get and set global simulation parameters
getMapPath

Get copies of sample files for examples and tests
.identifyChildModules

Identify child modules from a recursive list
initialize,simList-method

Generate a simList object
.fileExtensions

File extensions map
loadSimList

Load a saved simList and ancillary files
._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()
.keepAttrs

Attach missing attributes from x to y
.modifySearchPath

Modify package order in search path
maxTimeunit

Determine the largest timestep unit in a simulation
makeMemoisable.simList

Make simList correctly work with memoise
moduleCodeFiles

Extract the full file paths for R source code
moduleCoverage

Calculate module coverage of unit tests
minTimeunit

Determine the smallest timeunit in a simulation
memoryUseThisSession

Estimate memory used with system("ps")
moduleDiagram

Simulation module dependency diagram
moduleDefaults

Defaults values used in defineModule
.moduleDeps-class

The .moduleDeps class
.callingModuleName

Namespacing within SpaDES
newModuleTests

Create template testing structures for new modules
newModule

Create new module from template
moduleMetadata

Parse and extract module metadata
moduleVersion

Parse and extract a module's version
moduleGraph

Build a module dependency graph
newProject

Create new SpaDES project
newProjectCode

Create new module code file
noEventWarning

Text for no event with that name
moduleParams

Extract a module's parameters, inputs, or outputs
.parseElems,simList-method

.parseElems for simList class objects
objectSynonyms

Identify synonyms in a simList
paramCheckOtherMods

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

Simulation object dependency diagram
objs

Extract or replace an object from the simulation environment
params

Get and set simulation parameters
openModules

Open all modules nested within a base directory
objSize.simList

Object size for simList
.parseMessage

Prepend module name to a message
packages

Get module or simulation package dependencies
rasterCreate

Simple wrapper to load any Raster* object
newProgressBar

Progress bar
rasterToMemory

Read raster to memory
.quickCheck

The SpaDES.core variable to switch between quick and robust checking
.prepareOutput,simList-method

.prepareOutput for simList objects
progressInterval

Get and set simulation progress bar details
priority

Event priority
.preDigestByClass,simList-method

Pre-digesting method for simList
.parseModulePartial

Parse and initialize a module
.pkgEnv

The SpaDES.core package environment
restartR

Restart R programmatically
.runCodeChecks

Runs a series of code checks during simInit()
.rndstr

Generate random strings
saveFiles

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

Run module's .inputObjects
.robustDigest,simList-method

.robustDigest for simList objects
saveSimList

Save a whole simList object to disk
reexports

Objects exported from other packages
remoteFileSize

Determine the size of a remotely hosted file
restartSpades

Restart an interrupted simulation
scheduleEvent

Schedule a simulation event
simInit

Initialize a new simulation
savedSimEnv

Retrieve environment for saving interrupted simulations
scheduleConditionalEvent

Schedule a conditional simulation event
.sim2gantt

sim2gantt
simInitAndSpades2

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

Generate simulation file name
show,simList-method

Show an Object
.simDeps-class

The .simDeps class
setPaths

Get and set default working directories
events

Simulation event lists
paths

Specify paths for modules, inputs, outputs, and temporary rasters
simList-class

The simList class
times

Time usage in SpaDES
inputObjects

Metadata accessors
modules

Simulation modules and dependencies
newObjectsCreated

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

Simulation environment
inputs

Simulation inputs
outputs

Simulation outputs
inSeconds

Convert time units
spadesOptions

SpaDES.core options
spadesClasses

Classes defined in SpaDES
.tagsByClass,simList-method

.tagsByClass for simList objects
dhour

SpaDES time units
spades2

spades2 is a convenience wrapper for do.call(spades, listOfArgs), i.e., a user can pass a list of all the arguments.
[,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
.unparsed

Determine which modules in a list are unparsed
.tryCatch

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

Write RNG state info to file
use_gha

Use GitHub actions for automated module checking
zipModule

Create a zip archive of a module subdirectory
writeEventInfo

Write simulation event info to file
.verb

Chose verb conjugation for "to be"
updateList

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