2
A = data.table(idxA = rep(1:5, 2), valueA = runif(10))
B = data.table(idxB = rep(4:8, 2), valueB = runif(10))
C = A[B, on = .(idxA < idxB), allow.cartesian = TRUE]

How can I get the column idxB in the joined table C, ie for C to have both idxA and idxB columns?

jf328
  • 6,841
  • 10
  • 58
  • 82
  • 1
    Related: [Non-equi join using data.table: column missing from the output](https://stackoverflow.com/questions/44282044/non-equi-join-using-data-table-column-missing-from-the-output). See the also last two sections on the `j` argument in `?data.table`. – Henrik Jan 19 '18 at 12:11
  • 1
    Thanks, yes that's it. On the other hand, I do find R's way of documentation quite ineffective. – jf328 Jan 19 '18 at 12:31

0 Answers0