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.
NOTE: use capital C, to limit confusion with data.table::copy()
See Copy.
# S4 method for simList
Copy(object, filebackedDir, objects, queues)An R object (likely containing environments) or an environment.
A directory to copy any files that are backing R objects,
currently only valid for Raster classes. Defaults
to tempdir(), which is unlikely to be very useful.
Can be NULL, which means that the file will not be
copied and could therefore cause a collision as the
pre-copied object and post-copied object would have the same
file backing them.
Whether the objects contained within the simList environment
should be copied. Default TRUE, which may be slow.
Logical. Should the events queues (events,
current, completed) be deep copied via
data.table::copy
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.