What is the best practice to delete columns programmatically in data.table
?
The following works:
DT[, c("a", "b") := NULL]
But when trying to do this using a variable that stores column names
cols.to.del <- c("a", "b")
DT[, cols.to.del := NULL]
it fails badly as cols.to.del
is not evaluated in the correct environment.