copy: Copy an RStatic Object

Description Usage Arguments Details See Also Examples

View source: R/copy.R

Description

This function copies the given RStatic object, while ensuring that parent-child relationships are preserved for the copied object.

Usage

1
copy(x, ...)

Arguments

x

The object to copy.

...

Additional arguments to methods.

skip_set_parent

(character) Names of fields which should never have set_parent called on them.

Details

If x is any other R6 object, x is deep-cloned. If x is not an R6 object, no action is taken and x is returned.

Since RStatic objects are references, assignment does not make a copy. This function can be used to explicitly copy an RStatic object.

See Also

set_parent, which is used by this function.

Examples

1
2
3
4
5
6
7
x = quote_ast(x <- "Hi DTL!")
y = x
z = copy(x)

x$read = Numeric$new(141)

# Changing 'x' changed 'y' (a reference), but not 'z' (a copy).

nick-ulle/ast documentation built on Oct. 18, 2019, 4:37 a.m.