Is it possible to update more than 1 column of a data.table in the same statement?
Something like
dt[,onecol:=1 anothercol:=2]
I’ve seen some examples where they do
dt[,c("onecol","anothercol"):=1]
but I don’t know how to assign different formulas to each column
Yes, this has been possible since version 1.8.4:
Or, doing the same thing in a more readable way:
Search the current data.table NEWS file for “Multiple LHS” to see that this will also work with a
by=argument.