Given the following data.tables, I am surprised to see that index 5.9 corresponds to 5, not 6.
I do not quite understand what is happening.
dat <- data.table(index = c(4.3, 5.9, 1.2), datval = runif(3)+10, datstuff="test") reference <- data.table(index = 1:10, refjunk = "junk", refval = runif(10)) dat[, dat_index := index] reference[dat, roll="nearest", on="index"]
I would expect to see 3 lines with index == 6 lines in the link matched with index == 5.9 lines in dat, at least for my understanding in the near.
Is this the expected behavior?
Using R 3.3.2, data.table 1.10.4
source share