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

disctint() doesn't respect the order of variables provided #3195

Closed
fmichonneau opened this issue Nov 6, 2017 · 1 comment
Closed

disctint() doesn't respect the order of variables provided #3195

fmichonneau opened this issue Nov 6, 2017 · 1 comment
Assignees
Labels

Comments

@fmichonneau
Copy link

@fmichonneau fmichonneau commented Nov 6, 2017

The output of distinct() doesn't follow the order of the columns provided by the user but uses the order of the original data:

> starwars %>% distinct(hair_color, skin_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
> 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
@romainfrancois romainfrancois self-assigned this Apr 11, 2018
@krlmlr krlmlr closed this in 6fd8550 May 2, 2018
krlmlr added a commit that referenced this issue May 2, 2018
- `distinct()` respects the order of the variables provided (#3195, @foo-bar-baz-qux).

- Special case when the input data to `distinct()` has 0 rows and 0 columns (#2954).
@lock
Copy link

@lock lock bot commented Oct 29, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Oct 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants