Example data
d<-data.table(a=c(1,2,3,4,5))
I want this result:
d[a < 3]
How do achieve the same Using my.column
?
my.column<-'a'
d[my.column < 3]
#Empty data.table (0 rows) of 1 col: a
Although the following works, I hope there is a better way:
setnames(d,my.column,"my.column")
d[my.column<3,]
setnames(d,'my.column',my.column)
Note that this also does not work
setkey(d,my.column)