copy {maditr} | R Documentation |
Copy an entire object
Description
Mainly intended to copy data.table objects because by default they are modified by reference. See example.
Usage
copy(x)
Arguments
x |
object |
Value
copy of the object 'x'
Examples
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
[Package maditr version 0.8.4 Index]