sub-simList-character-ANY-method: Extract an intact 'simList' but with subset of objects

[,simList,character,ANY-methodR Documentation

Extract an intact simList but with subset of objects

Description

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.

Usage

## S4 method for signature '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(s)

Eliot McIntire

Examples

s <- simInit()
s$a <- 1
s$b <- 2
s$d <- 3
s[c("a", "d")] # a simList with only 2 objects



SpaDES.core documentation built on June 22, 2024, 10:32 a.m.