If I try to join two data.tables that have the same column names, then .1
is appended to one of the names, but I don't seem to be able to access the name in the j
part of the DT[]
expression.
Example:
DT1 = data.table(name = letters, value = rnorm(26))
DT2 = data.table(name = letters, value = rnorm(26))
setkey(DT1, name)
DT1[DT2, value.1 - value] # this doesn't work
DT1[DT2][, value.1 - value] # this works
The motivation for this question was that I thought the single call would be quicker, this turns out not to be the case, leading to a separate question of why: Why is DT1[DT2][, value1-value] faster than DT1[DT2, value1-value] on data.table with fewer columns?