I’m running into an issue where a data.table has a column with the same name as a variable, and I would like to reference the variable in an i expression.
x <- data.table(y = 1:10, z = 11:20)
z <- data.table(y = 1:5, w = 21:25)
I want to extract the subset of x with values of y that are not in the y column of the data.table z. I can do the following:
ind <- setdiff(x[,y], z[,y])
But I can’t do the following:
because it tries to use the column z instead of the data.table z. Is there any way to get around that? I tried using “with = FALSE”, but that only seems to apply to the j expression.
Thank you for your help.