insightsengineering / insightsengineering/teal.picks

datasets forces only one dataset

Open
#107 0 comments 0 reactions 0 assignees View on GitHub
core enhancement
Dominant language
R
Stars
4
Forks
0
Avg merge
6d 11h
Merged PRs (30d)
3

Description

On some modules (teal.osprey, at `tm_g_patient_profile()` but there are others) there is a multiple choice of datasets, where multiple datasets can be selected.
I thought we could use something like :

``` r
library("teal.picks")
teal.picks::datasets(choices = c("dataset1", "dataset2"), multiple = TRUE)
#> Error in `.pick()`:
#> ! formal argument "multiple" matched by multiple actual arguments
```

Created on 2026-07-24 with [reprex v2.1.1](https://reprex.tidyverse.org)

As you can see we can't force to select multiple datasets because internally it uses `.pick(multiple = FALSE, ....)`.
Without it we could set something like:

```r
teal.picks::datasets(choices = starts_with("AD"), select = everything(), multiple = TRUE)
```

And then resolve as usual.

I think the default of `multiple = FALSE` is sensible but we might want to make it a bit more flexible so we can work around the issue.
So the new API could be `function(choices = tidyselect::everything(), selected = 1L, fixed = NULL, multiple = FALSE, ...) {` and use that argument for `.picks()`

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the shown teal.picks::datasets call, then trace datasets and its internal .pick/.picks calls, including the usage from tm_g_patient_profile(). The change is complete when callers can request multiple datasets through the proposed API while the default single-dataset behavior still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.