clone | R Documentation |
Clone an lvec object
clone(x, ...) ## S3 method for class 'lvec' clone(x, ...)
x |
|
... |
ignored; used to pass additional arguments to other methods |
lvec
objects are basically pointers to pieces of memory.
When copying an object only the pointer is copied and when modifying the copied
object also the original object is modified. The advantage of this is speed:
these is less copying of the complete vector. In order to obtain a true copy
of an lvec
code can be used.
a <- as_lvec(1:3) # Copy b <- a # When modifying the copy also the original is modified lset(b, 1, 10) print(a) print(b) # Use clone to make a true copy b <- clone(a) lset(b, 1, 100) print(a) print(b)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.