modifies data.table in place, alias for modify with copy=TRUE and sequential=TRUE. It follows the naming convention in data.table to prefix methods that change objects (byreference) with set.

setmodify(dat, x, ...)

Arguments

dat

data.table() object

x

dcmodify::modifier object.

...

not used

See also

Examples

library(data.table) m <- modifier( if (age > 130) age = 130 , income[age < 12] <- 0 ) dat <- fread(text = "age, income 140, 300 11, 2000 25, 3000" ) # modify a copy of the data dat_m <- modify(dat, m, copy = TRUE) print(dat_m)
#> age income #> 1: 130 300 #> 2: 11 0 #> 3: 25 3000
# the data it self setmodify(dat, m) print(dat)
#> age income #> 1: 130 300 #> 2: 11 0 #> 3: 25 3000