insightsengineering / teal.modules.general

General Purpose Teal Modules
https://insightsengineering.github.io/teal.modules.general/
Other
9 stars 11 forks source link

tm_outliers vignette example broken #255

Closed mhallal1 closed 2 years ago

mhallal1 commented 2 years ago

In the TMG vignette of tm_outliers, running the app breaks with the following error:

Warning: Error in FUN: is.list(selector) is not TRUE
  [No stack trace available]
gogonzo commented 2 years ago

reproducible example

devtools::load_all("../teal")
devtools::load_all("../teal.devel")
devtools::load_all("../teal.modules.general/")
library(scda) # used to create data sets
library(dplyr) # used to modify data sets

ADSL <- synthetic_cdisc_data("latest")$adsl # nolint
ADRS <- synthetic_cdisc_data("latest")$adrs # nolint
ADLB <- synthetic_cdisc_data("latest")$adlb # nolint

app <- init(
  data = cdisc_data(
    cdisc_dataset("ADSL", ADSL, code = "ADSL <- synthetic_cdisc_data(\"latest\")$adsl"),
    cdisc_dataset("ADRS", ADRS, code = "ADRS <- synthetic_cdisc_data(\"latest\")$adrs"),
    cdisc_dataset("ADLB", ADLB, code = "ADLB <- synthetic_cdisc_data(\"latest\")$adlb"),
    check = TRUE
  ),
  modules = root_modules(
    # tm_outliers ----
    modules(
      label = "Outliers module",
      tm_outliers(
        label = "Multiple long datasets",
        outlier_var = list(
          data_extract_spec(
            dataname = "ADRS",
            select = select_spec(
              label = "Select variable:",
              choices = variable_choices(ADRS, c("ADY", "EOSDY")),
              selected = "ADY",
              fixed = FALSE
            )
          ),
          data_extract_spec(
            dataname = "ADLB",
            select = select_spec(
              label = "Select variable:",
              choices = variable_choices(ADLB, c("AVAL", "CHG2")),
              selected = "AVAL",
              multiple = FALSE,
              fixed = FALSE
            )
          )
        ),
        categorical_var = list(
          data_extract_spec(
            dataname = "ADRS",
            select = select_spec(
              label = "Select variables:",
              choices = variable_choices(ADRS, c("ARM", "ACTARM")),
              selected = "ARM",
              multiple = FALSE,
              fixed = FALSE
            )
          ),
          data_extract_spec(
            dataname = "ADLB",
            select = select_spec(
              label = "Select variables:",
              choices = variable_choices(ADLB, subset = names(Filter(isTRUE, sapply(ADLB, is.factor)))),
              selected = "RACE",
              multiple = FALSE,
              fixed = FALSE
            )
          )
        )
      )
    )
  )
)

runApp(app)