phuse-org / valtools

Validation framework for R packages used in clinical research and drug development.
https://phuse-org.github.io/valtools/
Other
51 stars 10 forks source link

Updates to add in tidyselect ability for new item creation #98

Closed elimillera closed 3 years ago

elimillera commented 3 years ago

Tidyselect Operators in Validation Items

This PR adds in logic for using tidyselect operators when using vt_add_file_to_config() or any vt_use_<item>(). The way I implemented this is a little hacky so I would love any suggestions for how to improve it.

The idea is tidyselect::eval_select() only works on data.frames and pulls out the names, so I make a one row data.frame and name it with the validation items. Then I use eval_select() on that data.frame to get the first(before) or last(after) name that was found using the function.

Also updated insert_list_locator() to not error out when the selection puts the item at the bottom.

thebioengineer commented 3 years ago

based on the documentation of eval_select() - it should accept a named vector.

Also my assumption with this is that we would wholly move to using internals that are based on or at least very similar to dplyr::relocate() - so at least my thought is that we don't need to make it work with the prior code. I hope that will make the process cleaner and a little more transparent🤔

I'm thinking on some code and will aim to open a PR with it tomorrow onto this.

thebioengineer commented 3 years ago

Merge develop into this branch first to ensure it has all the updates and I think we are good!