Thanks for the solution @nirgrahamuk vars is superseded, not sure if it is a good practice to use it.
It would be great to have the orderby_spec inside c like c(Species, desc(Sepal.Width))
The fact that that doesnt work in a normal arrange, is a bad sign.
The superceded tag does not disuade me, it just points the tidyverse developers not realising there was still juice on vars; Which is a thin wrapper around rlang::quos
And a thank you from me @nirgrahamuk. I had this as a side project.
I had wanted to pass in 2 parameters to a function. Each a list of columns and one with the ability to determine sort order.
I don't have test data for a reprex but the gist of it below. DeDup gives unique rows based on indexes (IDs/keys) by sorting based on the order specification in orderfields
The deduplication method is the standard sort and take the first row from each group of identical rows by the ID field.
Example below will take the latest update date with ties decided by create date