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
sorting tidy selection ? #259
Comments
Another thing that would be nice if you consider this feature, is to be able to keep the original order of columns. library(dplyr, warn = F)
select(starwars, starts_with("h") | starts_with("s"))
#> # A tibble: 87 × 7
#> height hair_color homeworld skin_color sex species starships
#> <int> <chr> <chr> <chr> <chr> <chr> <list>
#> 1 172 blond Tatooine fair male Human <chr [2]>
#> 2 167 <NA> Tatooine gold none Droid <chr [0]>
#> 3 96 <NA> Naboo white, blue none Droid <chr [0]>
#> 4 202 none Tatooine white male Human <chr [1]>
#> 5 150 brown Alderaan light female Human <chr [0]>
#> 6 178 brown, grey Tatooine light male Human <chr [0]>
#> 7 165 brown Tatooine light female Human <chr [0]>
#> 8 97 <NA> Tatooine white, red none Droid <chr [0]>
#> 9 183 black Tatooine light male Human <chr [1]>
#> 10 182 auburn, white Stewjon fair male Human <chr [5]>
#> # … with 77 more rows Maybe instead of the |
I think this is out of scope for tidyselect because we think now of the selections as logical combinations, so there's no sense of order. We might revisit this in the future, but for now we want stay focussed purely on selection, not ordering. |
There seems to be no easy way to sort tidy selections.
There are always workarounds but people tend to resort to idioms that are neither very elegant or general, some examples in this thread: https://twitter.com/antoine_fabri/status/1522328925204099072
Thanks to the flexibility of the package I could build a solution myself, would it make sense to have something like this in the package itself ?
The text was updated successfully, but these errors were encountered: