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 simList,character,ANY
[(x, i, j, ..., drop = TRUE)

Arguments

x

A simList

i

A character vector of objects to select.

j

Not used.

...

Not used.

drop

Not used.

Value

The [ method returns a complete simList class with all the slots copied from the original, but only the named objects in i are returned.

Author

Eliot McIntire

Examples

s <- simInit()
#> Setting:
#>   options(
#>     reproducible.cachePath = '/tmp/RtmpuFWiRK/cache'
#>     spades.inputPath = '/tmp/RtmpuFWiRK/inputs'
#>     spades.outputPath = '/tmp/RtmpuFWiRK'
#>     spades.modulePath = '/tmp/RtmpuFWiRK/sampleModules'
#>     spades.scratchPath = '/tmp/RtmpuFWiRK/scratch'
#>   )
#> Apr09 19:33:54 simInit Using setDTthreads(1). To change: 'options(spades.DTthreads = X)'.
#> Elpsed time for simInit: 0.02658749 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
#>