Skip to content

distinct() doesn't respect user-specified column order #6156

@sfirke

Description

@sfirke

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.

starwars %>% distinct(skin_color, hair_color)

#> # A tibble: 50 x 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-01-14 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorrows ↕️Operations on rows: filter(), slice(), arrange()

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions