-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error messages from merge() somewhat confusingly "swap" 'x' and 'i' prefixes #6641
Comments
Perhaps one can raise an errorCondition with a custom 'call' argument such that 'bmerge(i, x, leftcols,...' becomes 'bmerge(i = DT2, x = DT1, leftcols,...' though not standard |
Great idea! I think we can populate custom attributes of the error object raised on the custom class and use those more reliably & transparently than messing with the call. |
Hi @MichaelChirico, I would like to work on this issue. can you assign me this issue, As i have figure out what to do. for reference, its error output will be: |
Thanks @Abhishek2634, the issue with your proposed fix is it's incorrect for the "primary" merge interface, namely The root issue here is that The goal of this issue is to match the output to users' expectations in both cases (joins with It will probably require some understanding of condition objects in R: |
Note that the
x.
prefix applies toDT2
, while thei.
prefix applies toDT1
, while the user provided them in order(DT1, DT2)
.At root is that under the hood,
merge(x,y, ...)
is constructed as a join withy[x, ...]
.It would be most consistent with users' expectations of
merge()
if the prefixes wereDT1 : x.
,DT2: y.
, or perhaps even better if the errors matchedsuffixes=
. A really subtle (and back-incompatible) way to thread the needle here would be to change themerge.data.table()
defaults to besuffixes=c(".i", ".x")
.A different approach (and probably the most practical at this point) is just to emphasize this consideration in the docs.
The text was updated successfully, but these errors were encountered: