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

Shouldn't setequal ignore duplicates? #6057

Closed
juangomezduaso opened this issue Oct 19, 2021 · 1 comment
Closed

Shouldn't setequal ignore duplicates? #6057

juangomezduaso opened this issue Oct 19, 2021 · 1 comment
Labels
bug an unexpected problem or unintended behavior tables 🧮 joins and set operations

Comments

@juangomezduaso
Copy link

I thought that being in the group of set operations, setequal() would deem things like, say, mtcars and bind_rows(mtcars, mtcars) as equal, but it doesn´t.
i suppose this is the intended behavior, but in that case: Souldn´t this be explained somewhere in the documentation? My apologies if it already is, as I was unable to find it.
Taking into account that Rbase behavior in vectors ignores duplicates (and so bind_rows(mtcars,mtcars)[[1]] and mtcars[[1]] are equal) I think this clarification would be useful.

@DavisVaughan
Copy link
Member

Minimal reprex showing the difference with base R

setequal(1, c(1, 1))
#> [1] TRUE

dplyr::setequal(data.frame(x = 1), data.frame(x = c(1, 1)))
#> [1] FALSE

Seems reasonable that we should be consistent and drop duplicates before checking

@hadley hadley added bug an unexpected problem or unintended behavior tables 🧮 joins and set operations labels Apr 16, 2022
hadley added a commit that referenced this issue Jul 22, 2022
@hadley hadley changed the title Shouldn´t setequal ignore duplicates? Shouldn't setequal ignore duplicates? Jul 22, 2022
@hadley hadley closed this as completed in 13ced6c Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior tables 🧮 joins and set operations
Projects
None yet
Development

No branches or pull requests

3 participants