-
Notifications
You must be signed in to change notification settings - Fork 993
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
Joins depend on column order. Normal behaviour? #1179
Comments
The error message sort of explains: you see |
Yes, but is this expected behaviour? I would expect a join on the key column "a", irrespective of the position of column "a" in the data.table |
Yes. You can try using |
The yellow box in this answer pretty much explains the current status of joins. Joining by column name rather than position when When #1130 will be implemented, the interface will be much better (and transparent). |
Thanks you both. That makes sense. DT4 <- data.table(a=factor(1:6), key="a")
DT5 <- data.table(a=letters[1:3], b=1:3)
DT4[DT5] # This is not expected to work
# a b
# 1: 1 a
# 2: 2 b
# 3: 3 c I've only started to explore joins. I'm not sure what is considered as the expected behaviour, therefore it would be unsafe to PR myself. |
Hm. In 1.9.4, I do not see that, but rather
which is what I expect. There are no matches (so |
@ChristK not sure which commit you're using. I get this: # a b
# 1: a 1
# 2: b 2
# 3: c 3 And this is what I expect. @franknarf1 why would you expect the result you show? It was a bug in 1.9.4 that was fixed recently.
However, there are no columns in Joins between character and factor types are allowed in data.tables. |
@arunsrinivasan I guess I've been using 1.9.4 so long (after like a year not using R) that I've come to rationalize what I see (and I've seen this bug several times, not thinking it a bug). Whoops. |
@arunsrinivasan Now I get it! Thank you for your time and insight. |
@ChristK 👍 |
I'm not an expert on joins but this doesn't look normal to me. See below.
In more complex cases this doesn't break but continuous silently giving unexpected results
The text was updated successfully, but these errors were encountered: