Learn R Programming

SpaDES.core (version 0.2.4)

params: Get and set simulation parameters.

Description

params and P access the parameter slot in the simList. params has a replace method, so can be used to update a parameter value.

Usage

params(sim)

# S4 method for simList params(sim)

params(sim) <- value

# S4 method for simList params(sim) <- value

P(sim, module, param)

parameters(sim, asDF = FALSE)

# S4 method for simList parameters(sim, asDF = FALSE)

Arguments

sim

A simList object from which to extract element(s) or in which to replace element(s).

value

The object to be stored at the slot.

module

Optional character string indicating which module params should come from.

param

Optional character string indicating which parameter to choose.

asDF

Logical. For parameters, if TRUE, this will produce a single data.frame of all model parameters. If FALSE, then it will return a data.frame with 1 row for each parameter within nested lists, with the same structure as params.

Value

Returns or sets the value of the slot from the simList object.

See Also

SpaDES.core-package, specifically the section 1.2.1 on Simulation parameters.

Other functions to access elements of a simList object: .addDepends, doEvent.checkpoint, envir, events, globals, inputs, modules, objs, packages, paths, progressInterval, times

Examples

Run this code
# NOT RUN {
modules <- list("randomLandscapes")
paths <- list(modulePath = system.file("sampleModules", package = "SpaDES.core"))
mySim <- simInit(modules = modules, paths = paths,
                 params = list(.globals = list(stackName = "landscape")))
parameters(mySim)

# }

Run the code above in your browser using DataLab