# NOT RUN {
# set_dt
x = 1:10
x[c(1:2, 5:6, 9:10)] = NA
dt = data.table(v1=x, v2=lag_dt(x)/2, v3=lead_dt(x, 1L)/2)
dt
set_dt(dt,new_name = c("A","B","C"),fill_cols = names(dt),
order_by = "A",order_dirc = -1,col_order = c("B","A","C"))
dt
# mutate_ref
copy(iris) -> a
# never use pipe(%>%) for the `mutate_ref` function
mutate_ref(a,one = 1,two = 2)
a
# }
Run the code above in your browser using DataLab