Learn R Programming

SpaDES.core (version 2.0.5)

moduleMetadata: Parse and extract module metadata

Description

Parse and extract module metadata

Usage

moduleMetadata(
  sim,
  module,
  path = getOption("spades.modulePath", NULL),
  defineModuleListItems = c("name", "description", "keywords", "childModules", "authors",
    "version", "spatialExtent", "timeframe", "timeunit", "citation", "documentation",
    "reqdPkgs", "parameters", "inputObjects", "outputObjects")
)

# S4 method for missing,character,character moduleMetadata(module, path, defineModuleListItems)

# S4 method for missing,character,missing moduleMetadata(module, defineModuleListItems)

# S4 method for ANY,ANY,ANY moduleMetadata( sim, module, path = getOption("spades.modulePath", NULL), defineModuleListItems = c("name", "description", "keywords", "childModules", "authors", "version", "spatialExtent", "timeframe", "timeunit", "citation", "documentation", "reqdPkgs", "parameters", "inputObjects", "outputObjects") )

Value

A list of module metadata, matching the structure in defineModule().

Arguments

sim

A simList simulation object, generally produced by simInit.

module

Character string. Your module's name.

path

Character string specifying the file path to modules directory. Default is to use the spades.modulePath option.

defineModuleListItems

A vector of metadata entries to return values about.

Author

Alex Chubaty

See Also

defineModule()

Examples

Run this code
## turn off code checking -- don't need it here
opts <- options("spades.moduleCodeChecks" = FALSE,
                "spades.useRequire" = FALSE)

path <- getSampleModules(tempdir())
sampleModules <- dir(path)
x <- moduleMetadata(sampleModules[3], path = path)

## using simList
if (require("SpaDES.tools", quietly = TRUE)) {
   mySim <- simInit(
      times = list(start = 2000.0, end = 2001.0, timeunit = "year"),
      params = list(
        .globals = list(stackName = "landscape")
      ),
      modules = list("caribouMovement"),
      paths = list(modulePath = path)
   )
   moduleMetadata(sim = mySim)
}

# turn code checking back on -- don't need it here
options(opts)

Run the code above in your browser using DataLab