powered by
Mainly intended to copy data.table objects because by default they are modified by reference. See example.
copy(x)
copy of the object 'x'
object
data(mtcars) dt_mtcars = as.data.table(mtcars) dt_mtcars2 = dt_mtcars dt_mtcars3 = copy(dt_mtcars) let(dt_mtcars, new = 1) head(dt_mtcars2) # we see 'new' column head(dt_mtcars3) # no 'new' column
Run the code above in your browser using DataLab