copy: Copy an entire object

View source: R/text_expand.R

copyR 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

maditr documentation built on April 2, 2022, 5:05 p.m.