Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upnon-equi join with .EACHI fails unexpectedly (seemingly related to values in join columns) #4489
Comments
|
Ahaa! Thanks a lot Jan for your rapid reply. I (naively) thought that we, simply stated, either should use |
|
For Perhaps in the meanwhile, |
|
Arun, thanks a lot for your feedback. When I saw your rethink the logic of issuing error, I realized had I forgot to mention some thoughts on the error message in OP. I have added them now, just so that they are "archived" somewhere, FWIW. Cheers. |
I have some time series with values. Apart from different values, the structure of the data sets are the same. A small example:
For each time, I want to determine the number of rows after the focal time where the values are larger than the focal value. E.g. for time 2 (value 7) there is one subsequent value which is higher (8 at time 5).
There may be better ways to reach my goal, but here's the code I used and which gave me the desired result:
The code works for most data, but in some rare instances it errors. After digging back and forth, I thought I had found the reason: the error was triggered by setting the value 'v' equal to the time on two rows. E.g.:
However, if the value at time 5 instead of time 7 was changed, it works...
What's going on here? (most parsimonous guess: user error ;) I think I'm slightly confused by the error message. Although
Join results in 18 rows; more than 16 = nrow(x)+nrow(i).is true for the join per se, I use.EACHIto aggregate the data to have less rows than thenrow(x)+nrow(i)limit. In addition,try by=.EACHIis indeed a great suggestion, but I already use it. I clearly have misunderstood something here.Tried on Windows,
R version 3.6.3,data.table 1.12.9 IN DEVELOPMENT built 2020-02-20, and on Windows,R version 4.0.0,data.table 1.12.8