Copy: Copy for 'simList' class objects

Copy,simList-methodR Documentation

Copy for simList class objects

Description

Because a simList works with an environment to hold all objects, all objects within that slot are pass-by-reference. That means it is not possible to simply copy an object with an assignment operator: the two objects will share the same objects. As one simList object changes so will the other. When this is not the desired behaviour, use this function.

Usage

## S4 method for signature 'simList'
Copy(object, objects, queues, ...)

Arguments

object

An R object (likely containing environments) or an environment.

objects

Whether the objects contained within the simList environment should be copied. Default TRUE, which may be slow.

queues

Logical. Should the events queues (events, current, completed) be deep copied via data.table::copy()

...

Only used for custom Methods

Details

simList objects can contain a lot of information, much of which could be in pass-by-reference objects (e.g., data.table class), and objects that are file-backed, such as some ⁠Raster*⁠-class objects. For all the objects that are file-backed, it is likely very important to give unique file-backed directories. This should be passed here, which gets passed on to the many methods of Copy in reproducible.

Value

a copy of object

Note

uses capital C, to limit confusion with e.g., data.table::copy().

Author(s)

Eliot McIntire

See Also

reproducible::Copy()

reproducible::Copy()


PredictiveEcology/SpaDES.core documentation built on April 17, 2024, 8:27 a.m.