We can use the %<>%
compound assignment operator from magrittr
to change in place
library(magrittr)
df_test %<>%
mutate(a = round(a,0))
If we are using data.table
, the assignment (:=
) operator does this in place too without copying
library(data.table)
setDT(df_test)[, a := round(a,0)]