
Last chance! 50% off unlimited learning
Sale ends in
clone
physically duplicates objects and can additionally change some features, e.g. length.
clone(x, …)
# S3 method for list
clone(x, …)
# S3 method for default
clone(x, …)
still.identical(x, y)
x
y
further arguments to the generic
an object that is a deep copy of x
clone
is generic.
clone.default
currently only handles atomics.
clone.list
recursively clones list elements.
still.identical
returns TRUE if the two atomic arguments still point to the same memory.
# NOT RUN {
x <- 1:12
y <- x
still.identical(x,y)
y[1] <- y[1]
still.identical(x,y)
y <- clone(x)
still.identical(x,y)
rm(x,y); gc()
# }
Run the code above in your browser using DataLab