How do I get the following code to recognize the second a
in dt[a == a,]
as an external variable with value 3?
a <- 3
dt <- data.table(a = seq(5), b = rnorm(5))
dt[a==a,]
Expected output should be the same as the output from dt[a==3,]
.
EDIT:
I'm aware that there's a solution available here: Subsetting data.table using variables with same name as column
But the answer is from 4 years ago and the first comment mentions that the package maintainers are aware of this scoping issue and are working to fix it. So, is there now a straightforward way to address this?