-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
inner_join character and factor #455
Comments
Can you spare some reproducible example please. |
Possibly related to issue #450? Here's an example:
this doesn't work:
however using
what's even weirder is what happens when you switch who has the factor variable:
|
Here's an even smaller example:
|
Yep, the same |
And here's a test test_that("inner_join is symmetric (even when joining on character & factor)", {
foo <- data_frame(id = c("a", "b"), var1 = factor("foo"))
bar <- data_frame(id = c("a", "b"), var2 = "bar")
tmp1 <- inner_join(foo, bar, by="id")
tmp2 <- inner_join(bar, foo, by="id")
expect_is(tmp1$var1, "character")
expect_is(tmp2$var1, "character")
expect_equal(names(tmp1), c("id", "var1", "var2"))
expect_equal(names(tmp2), c("id", "var2", "var1"))
expect_equal(tmp1, tmp2)
}) |
I don't get it. I think it is perfectly normal that:
Perhaps
which indeed gives something wrong:
|
@romainfrancois oh oops, yeah, I think I put factor around the wrong variable |
I think it's ok now, at least according to the test I put in place here; |
Hi Romain, I think you have left a couple of |
That is intended. |
I've noticed that if you join on column which is character in one table and factor in another, you're getting unstable results. Some records match, some not. Should the function return an error, or at least a warning, that your columns have different type?
The text was updated successfully, but these errors were encountered: