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

Formally switch to radix ordering in vec_order() #1375

Closed

Conversation

DavisVaughan
Copy link
Member

@DavisVaughan DavisVaughan commented Apr 27, 2021

Closes #1302

  • Renames vec_order() to new vec_order_base()
  • Renames vec_order_radix() to vec_order()
  • Folds order-radix.R into order.R (similar with tests, and C side)
  • Big NEWS bullet outlining the changes
    • One of which is that I've added ... to both vec_order() and vec_sort(), which feels appropriate given that we have so many optional arguments to them now, and could potentially add more.

Will likely wait quite a while to merge this PR, as it will immediately affect dplyr and slider

Copy link
Member

@lionel- lionel- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are changing the default I think we should consider a C sort variant with letters swapped so that it's closer to POSIX sorting. It's probably nearly as efficient and will sort more usefully with English datasets (and other alphbetical languages).

R/order.R Outdated Show resolved Hide resolved
R/order.R Outdated Show resolved Hide resolved
R/order.R Outdated Show resolved Hide resolved
@lionel-
Copy link
Member

lionel- commented Apr 28, 2021

Eventually we'll have character classes that attach a locale to a vector. Compared to sorting with the current locale, these will have the advantage of producing a consistent sort across platforms. The most obvious way to implement this class is with an order proxy.

So I'm wondering what is the interaction between chr_transform, which is presented as a way of setting a locale for sorting, and the order proxy? I think it would be helpful to clarify this and maybe implement a POC localised character class before cementing the design.

@hadley
Copy link
Member

hadley commented Apr 28, 2021

We're going to argue that this change increases consistency with stringr and data.table; I think using some custom sort would be a step in the wrong direction.

@DavisVaughan
Copy link
Member Author

Superseded by #1435 which is a clean rebase of this on master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export vec_order_radix()
3 participants