library(data.table)
irisDT = as.data.table(iris)
I am looking for this:
irisDT[, NewCol:= Sepal.Length]
but then programmatically, so with var = "Sepal.Length".
I would expect something like this:
var = "Sepal.Length"
irisDT[, NewCol := eval(var)]
This
var = "Sepal.Length"
irisDT$NewCol = irisDT[[var]] 
works, but irisDT is copied internally, which is undesirable.
Any help is welcome:-)
 
    