Feature Request: Add the possibility to keep initial sorting order to restrict_derivation
#2508
Replies: 11 comments
-
The admiral functions don't attempt to preserve the sort order. Thus I wonder if we should add two helper functions instead of adding the
@pharmaverse/admiral , what do you think? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the issue @aassuied-ps. I agree with @bundfussr that we make it a point to not sort output datasets, especially because our code is generally ran within long pipe chains where these sorting steps would be superfluous. I'm not sure about adding the helper functions. I feel like they may bloat the package, so I would only add if there is real need for them. |
Beta Was this translation helpful? Give feedback.
-
Understood, thank you for the answer : ) |
Beta Was this translation helpful? Give feedback.
-
@bundfussr Are you proposing a function that figures out how the data is sorted, stores that information and then a user can use it later on? If a user knows the preferred sort order, why can't they just use Apologies, just trying to understand the example and use case. |
Beta Was this translation helpful? Give feedback.
-
Yes, if we want to provide such functionality, I would implement it as separate helper functions. However, like Edoardo I'm not sure if there is a need for it.
Yes, if the users know the preferred sort order, they can just use |
Beta Was this translation helpful? Give feedback.
-
I think that the As an aside: Is there some sort of feature voting for admiral somewhere, where the community can vote on requested features? |
Beta Was this translation helpful? Give feedback.
-
ooohhh I would actually love this!! Be nice to pull this from raw data and check with what is being said is the sort order in the specs. Can see other use cases! Shall we close this and make a more generalized function request? |
Beta Was this translation helpful? Give feedback.
-
I would recommend not to add anything to admiral for this. we shouldn't add things already covered by tidyverse and also {metatools} provides https://pharmaverse.github.io/metatools/reference/sort_by_key.html which is a nice final sorting step based on your metadata primary keys. |
Beta Was this translation helpful? Give feedback.
-
My understanding is the new function is meant to pull out the how the data is actually sorted versus a function that applies a sort. I'm keen on this - perhaps we could develop here and push to metatools if we think it doesn't belong. |
Beta Was this translation helpful? Give feedback.
-
The proposed functions don't use any metadata. Thus I think they shouldn't be in metatools. |
Beta Was this translation helpful? Give feedback.
-
ah ok, thanks! my misunderstanding then. i had read it as we were trying to make our own sorting function. |
Beta Was this translation helpful? Give feedback.
-
Feature Idea
restrict_derivation
should allow the user to keep the initial sorting order of the initial dataset.For now this is not the case:
Relevant Input
Add an argument to restrict_derivation, for instance
keep_order
.Relevant Output
Using above example, with an argument to keep the initial sorting order, the result should look like this:
Reproducible Example/Pseudo Code
Beta Was this translation helpful? Give feedback.
All reactions