CHOP-CGTInformatics / REDCapTidieR

Makes it easy to read REDCap Projects into R
https://chop-cgtinformatics.github.io/REDCapTidieR/
Other
33 stars 8 forks source link

list_select Function Implementation #197

Closed rsh52 closed 3 months ago

rsh52 commented 3 months ago

Description

This PR introduced a very low-level function that we've found useful in working with the CGTTrialsReporter. A typical workflow we found was to use extract_tibbles() on a REDCap supertibble and then select specific named elements from that list output for our analytic objects. This has the additional benefit

A typical workflow, as documented in the roxygen example, is:

my_list <- extract_tibbles(superheroes_supertbl)
list_select(my_list, starts_with("hero"))

Open to name and param suggestions, additional checks, behavior modifications, etc. I originally wanted to call this supertibble_select(), but this doesn't really select from the supertibble. If anything extract_tibbles() already achieves this.

Currently if users make a tidyselection and nothing is returned, an empty named list is returned. But if they hard code a table to search for and it doesn't exist and helpful error is returned. Wasn't sure if both should error instead.

Proposed Changes

List changes below in bullet format:

PR Checklist

Before submitting this PR, please check and verify below that the submission meets the below criteria:

Code Review

This section to be used by the reviewer and developers during Code Review after PR submission

Code Review Checklist

rsh52 commented 3 months ago

Yea, fair enough. Personally fine with closing this if we don't think the value is really there, it didn't take much time to put together.

ezraporter commented 3 months ago

Yeah my opinion is that the value isn't there for this but there is value in a more comprehensive set of functions that allows you to select from and manipulate the supertibble

rsh52 commented 3 months ago

Say no more 🫡