Learn R Programming

SpaDES (version 1.3.1)

copy: Copy a simList object

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

copy(sim, objects = TRUE)

# S4 method for simList,logical copy(sim, objects = TRUE)

# S4 method for simList,missing copy(sim)

Arguments

sim

A simList object.

objects

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