# NOT RUN {
library(pryr)
rm(list = ls())
nr_of_rows <- 1e5
df <- data.table(
Logical = sample(c(TRUE, FALSE, NA),
prob = c(0.85, 0.1, 0.05),
nr_of_rows, replace = TRUE)
)
mem_change(mutate_dt(df,one = 1) -> res)
# makes no copy, update on "df" directly
mem_change(set_mutate(df,one = 1))
all.equal(res,df)
# }
Run the code above in your browser using DataLab