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

939

Version

2.0.5

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

April 25th, 2024

Functions in SpaDES.core (2.0.5)

Copy,simList-method

Copy for simList class objects
append_attr

Add a module to a moduleList
Plot,simList-method

Plot method for simList objects
.addChangedAttr,simList-method

.addChangedAttr for simList objects
Plots

Plot wrapper intended for use in a SpaDES module
anyPlotting

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

Simple wrapper around data.table::rbindlist
SpaDES.core-package

Categorized overview of the SpaDES.core package
checkParams

Check use and existence of parameters passed to simulation.
.checkCacheRepo,list-method

.checkCacheRepo for simList objects
.cacheMessage,simList-method

.cacheMessage for simList objects
.addDepends

Add simulation dependencies
checkModuleLocal

Check for the existence of a module locally
.addTagsToOutput,simList-method

.addTagsToOutput for simList objects
checkModule

Check for the existence of a remote module
checkpointFile

Simulation checkpoints.
all.equal.simList

All equal method for simList objects
.wrap.simList

Methods for .wrap and .unwrap
zipSimList

Zip a simList and various files
checkObject

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

Named list of core SpaDES modules
defineEvent

Alternative way to define events in SpaDES.core
createsOutput

Define an output object of a module
classFilter

Filter objects by class
checksums

Calculate checksum for a module's data files
citation

A citation method for SpaDES modules
.fillOutputRows

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

Build edge list for module dependency graph
.findElementsInEnv

Find all references to sim$
depsGraph

Build a module dependency graph
.depsLoadOrder

Determine module load order
convertToPackage

Convert standard module code into an R package
expectsInput

Define an input object that the module expects.
maxTimeunit

Determine the largest timestep unit in a simulation
.keepAttrs

Attach missing attributes from x to y
newProject

Create new SpaDES project
defineModule

Define a new module.
.getModuleInputObjects

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

Define a parameter used in a module
copyModule

Create a copy of an existing module
.fileExtensions

File extensions map
.fileEdit

Open a file for editing
.identifyChildModules

Identify child modules from a recursive list
extractURL

Extract a url from module metadata
newProjectCode

Create new module code file
ganttStatus

ganttStatus
fileName

Extract filename (without extension) of a file
.guessPkgFun

Guess package of a function
initialize,simList-method

Generate a simList object
.cleanPkgs

strip GitHub repo info from vector of packages
.depsPruneEdges

Prune edges to remove cycles in module dependencies
clearCache,simList-method

clearCache for simList objects
moduleDiagram

Simulation module dependency diagram
moduleGraph

Build a module dependency graph
.findObjects

Find objects if passed as character strings
downloadModule

Download a module from a SpaDES module GitHub repository
scheduleConditionalEvent

Schedule a conditional simulation event
downloadData

Download module data
getMapPath

Get copies of sample files for examples and tests
doEvent

Process a simulation event
scheduleEvent

Schedule a simulation event
.parseMessage

Prepend module name to a message
emptyEventList

Blank (template) event list
newProgressBar

Progress bar
.parseElems,simList-method

.parseElems for simList class objects
._inputObjectsDF

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

Check is module uses module namespacing
globals

Get and set global simulation parameters
simFile

Generate simulation file name
getModuleVersion

Find the latest module version from a SpaDES module repository
simInit

Initialize a new simulation
.fillInputRows

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

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

Save a whole simList object to disk
moduleCodeFiles

Extract the full file paths for R source code
moduleCoverage

Calculate module coverage of unit tests
saveFiles

Save objects using .saveObjects in params slot of simInit
moduleDefaults

Defaults values used in defineModule
.moduleDeps-class

The .moduleDeps class
.getOption

A slightly modified version of getOption()
objSize.simList

Object size for simList
moduleVersion

Parse and extract a module's version
spadesClasses

Classes defined in SpaDES
writeEventInfo

Write simulation event info to file
.fileTableIn

Create empty fileTable for inputs and outputs
eventDiagram

Simulation event diagram
objs

Extract or replace an object from the simulation environment
.prepareOutput,simList-method

.prepareOutput for simList objects
objectSynonyms

Identify synonyms in a simList
objectDiagram

Simulation object dependency diagram
.callingModuleName

Namespacing within SpaDES
.emptyMetadata

Default (empty) metadata
.verb

Chose verb conjugation for "to be"
.tagsByClass,simList-method

.tagsByClass for simList objects
rndstr

Generate random strings
.robustDigest,simList-method

.robustDigest for simList objects
inputObjects

Metadata accessors
memoryUseThisSession

Estimate memory used with system("ps")
.preDigestByClass,simList-method

Pre-digesting method for simList
modules

Simulation modules and dependencies
loadSimList

Load a saved simList and ancillary files
.sim2gantt

sim2gantt
spades

Run a spatial discrete event simulation
inSeconds

Convert time units
.findModuleName

Identify module names up to a given recursive level
.findSimList

Find simList in a nested list
[,simList,character,ANY-method

Extract an intact simList but with subset of objects
makeMemoisable.simList

Make simList correctly work with memoise
restartSpades

Restart an interrupted simulation
events

Simulation event lists
progressInterval

Get and set simulation progress bar details
.simDeps-class

The .simDeps class
minTimeunit

Determine the smallest timeunit in a simulation
openModules

Open all modules nested within a base directory
packages

Get module or simulation package dependencies
suppliedElsewhere

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

Parse and extract module metadata
priority

Event priority
restartR

Restart R programmatically
newModuleTests

Create template testing structures for new modules
newModuleDocumentation

Create new module documentation
.modifySearchPath

Modify package order in search path
newModule

Create new module from template
inputs

Simulation inputs
moduleParams

Extract a module's parameters, inputs, or outputs
.parseModulePartial

Parse and initialize a module
newModuleCode

Create new module code file
paramCheckOtherMods

Test and update a parameter against same parameter in other modules
.pkgEnv

The SpaDES.core package environment
times

Time usage in SpaDES
params

Get and set simulation parameters
.tryCatch

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

Determine which modules in a list are unparsed
simList-class

The simList class
remoteFileSize

Determine the size of a remotely hosted file
rasterCreate

Simple wrapper to load any Raster* object
rasterToMemory

Read raster to memory
show,simList-method

Show an Object
setPaths

Get and set default working directories
spadesOptions

SpaDES.core options
updateList

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

SpaDES time units
reexports

Objects exported from other packages
.runCodeChecks

Runs a series of code checks during simInit()
envir

Simulation environment
simInitAndSpades

Call simInit and spades together
writeRNGInfo

Write RNG state info to file
zipModule

Create a zip archive of a module subdirectory
paths

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

Simulation outputs
use_gha

Use GitHub actions for automated module checking
.runModuleInputObjects

Run module's .inputObjects