-
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
distinct() doesn't respect user-specified column order #6156
Comments
Actual reprex: library(dplyr, warn.conflicts = FALSE)
starwars %>% distinct(skin_color, hair_color)
#> # A tibble: 50 × 2
#> hair_color skin_color
#> <chr> <chr>
#> 1 blond fair
#> 2 <NA> gold
#> 3 <NA> white, blue
#> 4 none white
#> 5 brown light
#> 6 brown, grey light
#> 7 <NA> white, red
#> 8 black light
#> 9 auburn, white fair
#> 10 auburn, grey fair
#> # … with 40 more rows Created on 2022-04-16 by the reprex package (v2.0.1) |
hadley
added
bug
an unexpected problem or unintended behavior
rows ↕️
Operations on rows: filter(), slice(), arrange()
labels
Apr 16, 2022
Looks like I broke this by accident in #4691 |
hadley
added a commit
that referenced
this issue
Jul 21, 2022
hadley
added a commit
that referenced
this issue
Jul 22, 2022
It seems like this may have resurfaced (reprex using v1.0.10): library(dplyr, warn.conflicts = FALSE)
head(mtcars, 2)
#> mpg cyl disp hp drat wt qsec vs am gear carb
#> Mazda RX4 21 6 160 110 3.9 2.620 16.46 0 1 4 4
#> Mazda RX4 Wag 21 6 160 110 3.9 2.875 17.02 0 1 4 4
distinct(mtcars, cyl, mpg) %>% head(2)
#> mpg cyl
#> Mazda RX4 21.0 6
#> Datsun 710 22.8 4 Created on 2022-10-06 by the reprex package (v2.0.1) |
Fixed in the dev version though! library(dplyr, warn.conflicts = FALSE)
distinct(mtcars, cyl, mpg) %>% head(2)
#> cyl mpg
#> Mazda RX4 6 21.0
#> Datsun 710 4 22.8 Created on 2022-10-06 with reprex v2.0.2.9000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm again experiencing behavior that was reported as #3195, then closed years ago. I'll use the same reprex. Running dplyr 1.0.7.
The text was updated successfully, but these errors were encountered: