insightsengineering / insightsengineering/teal.picks
[Feature Request]: `values(keep_na = logical(1))` to handle `NA`
- Dominant language
- R
- Stars
- 4
- Forks
- 0
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 3
Description
### Feature description
Related to very old issue present in des also: https://github.com/insightsengineering/teal.transform/issues/30
We already found a quite nice solution in [`teal_slice(keep_na)`](https://insightsengineering.github.io/teal.slice/latest-tag/reference/teal_slice.html). In `teal.slice` when column contains any `NA`, checkbox input is automatically added to the filter-state-card. We expect similar in `pick_ui`
Consider following example
```r
data <- within(teal.data::teal_data(), {
iris <- iris
mtcars <- mtcars
iris$Species[1:5] <- NA
})
app <- init(
data = data,
modules = modules(
modules(
label = "Testing modules",
tm_merge(
label = "non adam",
picks = list(
a = picks(
datasets("iris", "iris"),
variables(
choices = c("Sepal.Length", "Species"),
selected = "Species"
),
values()
)
)
)
)
)
)
shinyApp(app$ui, app$server, enableBookmarking = "server")
```
1. how NA should be included in choices/selected?
```r
values(choices, selected, keep_na = TRUE/FALSE)
# adds keep_na to the attributes of the `pick` object
```
2. how NA should be displayed handled in the `pick_ui/srv`?
- checkbox-input should be added below pickerInput (or rangeSlider or other input related with class of the column)
- changing input should update attribute in the object
3. how NA should be handled in merge_srv
Reactive `keep_na` should be delivered somehow to `merge_srv > .qenv_merge > .merge_expr > .call_dplyr_filter` and handled respectively.
Contributor guide
Assessment
This issue has not been assessed yet.