Skip to content
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

vec_match() and NA matching #718

Closed
romainfrancois opened this issue Dec 25, 2019 · 0 comments · Fixed by #876
Closed

vec_match() and NA matching #718

romainfrancois opened this issue Dec 25, 2019 · 0 comments · Fixed by #876
Assignees
Labels

Comments

@romainfrancois
Copy link
Contributor

dplyr join functions internally use vec_match() now, but vec_match() always match NA, we need some way to implement *_join(..., na_matches = "never")

test_that("NAs match in joins only with na_matches = 'na' (#2033)", {
  skip("until vctrs can power na_matches = 'never'")

  df1 <- tibble(a = NA)
  df2 <- tibble(a = NA, b = 1:3)
  for (na_matches in c("na", "never")) {
    accept_na_match <- (na_matches == "na")
    expect_equal(inner_join(df1, df2, na_matches = na_matches) %>% nrow(), 0 + 3 * accept_na_match)
    expect_equal(left_join(df1, df2, na_matches = na_matches) %>% nrow(), 1 + 2 * accept_na_match)
    expect_equal(right_join(df2, df1, na_matches = na_matches) %>% nrow(), 1 + 2 * accept_na_match)
    expect_equal(full_join(df1, df2, na_matches = na_matches) %>% nrow(), 4 - accept_na_match)
    expect_equal(anti_join(df1, df2, na_matches = na_matches) %>% nrow(), 1 - accept_na_match)
    expect_equal(semi_join(df1, df2, na_matches = na_matches) %>% nrow(), 0 + accept_na_match)
  }
})
romainfrancois added a commit to tidyverse/dplyr that referenced this issue Dec 25, 2019
romainfrancois added a commit to tidyverse/dplyr that referenced this issue Dec 30, 2019
romainfrancois added a commit to tidyverse/dplyr that referenced this issue Jan 6, 2020
@hadley hadley added the dplyr label Jan 10, 2020
@lionel- lionel- self-assigned this Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants