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

Suggestion: get_dupes results should be sorted by dupe_count descending #493

Closed
sfirke opened this issue Nov 16, 2022 · 2 comments · Fixed by #511
Closed

Suggestion: get_dupes results should be sorted by dupe_count descending #493

sfirke opened this issue Nov 16, 2022 · 2 comments · Fixed by #511
Labels
seeking comments Users and any interested parties should please weigh in - this is in a discussion phase!

Comments

@sfirke
Copy link
Owner

sfirke commented Nov 16, 2022

Feature requests

Sort the results of get_dupes by dupe_count.

Remarks

Right now it sorts alphabetically by the grouping variable. But usually I then add %>% arrange(desc(dupe_count)) to start with the most-duplicated combination. I suppose this would potentially be a breaking change for some use cases. But I think it is ultimately more useful than the alphabetical sort.

Example

mtcars %>% get_dupes(cyl)

In my result, the group with cyl = 8 that has 14 records would appear first.

This would be easy to implement. Thoughts from others?

@sfirke sfirke added the seeking comments Users and any interested parties should please weigh in - this is in a discussion phase! label Nov 16, 2022
@billdenney
Copy link
Collaborator

It makes sense to me. When I use get_dupes(), the goal is either to confirm that there are no duplicates or to manually inspect them. Neither of my use cases is broken with your suggested change, and the manual inspection is improved.

My one addition would be to break a tie by sorting alphabetically second so that there is a consistent output order.

@jzadra
Copy link
Contributor

jzadra commented Nov 16, 2022

Yes I think this is a good enhancement.

JasonAizkalns added a commit to JasonAizkalns/janitor that referenced this issue Dec 1, 2022
sfirke added a commit that referenced this issue Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
seeking comments Users and any interested parties should please weigh in - this is in a discussion phase!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants