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.
For example, library(data.table) x <- data.table(y = 1:10, z = 11:20) setkey(x, y) z <- data.table(y = 1:5, w = 21:25) setkey(z, y) 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]) x[ind] But I can't do the following: x[setdiff(y, z[,y])] 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. - Elliot
_______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
