The [[ and $ operators provide "shortcuts" for accessing objects in the simulation environment. I.e., instead of using envir(sim)$object or envir(sim)[["object"]], one can simply use sim$object or sim[["object"]].

objs(sim, ...)

# S4 method for simList
objs(sim, ...)

objs(sim) <- value

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

moduleObjects(sim, module, path)

findObjects(objects, sim, module, path)

Arguments

sim

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

...

passed to ls

value

objects to assign to the simList

module

Character vector of module name(s)

path

The path to the module., i.e., the modulePath. Only relevant if sim not supplied.

objects

A character vector of length >= 1 with name(s) of objects to look for in the metadata. This is used in a grep, meaning it will do partial matching (e.g., "studyArea" will find "studyArea" and "studyAreaLarge"). User can use regular expressions.

Value

Returns or sets a list of objects in the simList environment.

moduleObjects returns a data.table with 4 columns, module, objectName, type, and desc, pulled directly from the object metadata in the createsOutputs and expectsInputs. These will be determined either from a simList or from the module source code.

findObjects returns a data.table similar to moduleObjects, but with only the objects provided by objects.

Details

objs can take ... arguments passed to ls, allowing, e.g. all.names=TRUE objs<- requires takes a named list of values to be assigned in the simulation environment.

See also

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

Other functions to access elements of a 'simList' object: .addDepends(), checkpointFile(), envir(), events(), globals(), inputs(), modules(), packages(), params(), paths(), progressInterval(), times()

Examples

# findObjects
path <- getSampleModules(tempdir())
findObjects(path = path, module = dir(path), objects = "caribou")
#>    objectName          module   type objectClass
#>        <char>          <char> <char>      <char>
#> 1:    caribou caribouMovement  input  SpatVector
#> 2:    caribou caribouMovement output  SpatVector
#>                                desc  other
#>                              <char> <AsIs>
#> 1: Object holding caribou locations       
#> 2:                               NA