Dump data.table modification script

dump_dt(x, name = "dat", file = stdout())

Arguments

x

dcmodify::modifier() object with the modification rules

name

character name of data.table to be used.

file

where should the generated file be written?

Examples

library(dcmodify) m <- modifier( if (age > 130) age = 130 , income[age < 12] <- 0 ) dump_dt(m, "my_data")
#> # #################################### #> # Generated by dcmodifydt, do not edit #> # dcmodify version: 0.1.9 #> # dcmodifydt version: 0.1.0.9000 #> # #################################### #> # ensure that sourcing the file only affects 'my_data' #> local({ #> dat <- my_data #> #> # M1: #> dat[age > 130, age := 130] #> #> # M2: #> dat[age < 12, income := 0] #> })