I am trying to add columns to my data.table, where the names are dynamic. I addition I need to use the by argument when adding these columns. For
data.table
by
I believe setnames(DT, c(col.names)) yields the most readable code
setnames(DT, c(col.names))