simList
but with subset of objectsR/simList-accessors.R
sub-simList-character-ANY-method.Rd
This is copies the non-object components of a simList
(e.g., events, etc.)
then selects only the objects listed in i
using Copy(mget(i, envir(sim)))
and adds them to the returned simList
.
# S4 method for class 'simList,character,ANY'
x[i, j, ..., drop = TRUE]
The [
method returns a complete simList
class with all the slots
copied from the original, but only the named objects in i
are returned.
s <- simInit()
#> Setting:
#> options(
#> reproducible.cachePath = '/tmp/Rtmp45trFG/cache'
#> spades.inputPath = '/tmp/Rtmp45trFG/inputs'
#> spades.outputPath = '/tmp/Rtmp45trFG'
#> spades.modulePath = '/tmp/Rtmp45trFG/sampleModules'
#> spades.scratchPath = '/tmp/Rtmp45trFG/scratch'
#> )
#> Nov21 04:22:59 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> Elpsed time for simInit: 0.02847648 secs
s$a <- 1
s$b <- 2
s$d <- 3
s[c("a", "d")] # a simList with only 2 objects
#> ================================================================================
#> >> Simulation dependencies:
#> use `depends(sim)` to view dependencies for each module
#>
#> >> Simulation times:
#> current start end timeunit
#> [1,] 0 0 10 "year"
#>
#> >> Modules:
#> Name Timeunit
#>
#> >> Objects Loaded:
#>
#> >> Objects stored:
#> a : num 1
#> d : num 3
#>
#> >> Parameters:
#> Module Parameter Value
#> checkpoint file
#> checkpoint interval NA
#>
#> >> Completed Events:
#> Null data.table (0 rows and 0 cols)
#>
#> >> Current Event:
#> Null data.table (0 rows and 0 cols)
#>
#> >> Scheduled Events:
#> eventTime moduleName eventType eventPriority
#> <num> <char> <char> <num>
#> 1: 0 checkpoint init 0
#> 2: 0 save init 0
#> 3: 0 progress init 0
#> 4: 0 load init 0
#>