-
-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
Description
What happened?
On the teal.gallery app under the exploratory app, the outlier module generates non reproducible code.
The error message generated is related to an issue on rtables (insightsengineering/rtables#1037) but the root cause is that the module generates an empty data.frame if there are no categorical variables this cannot be processed by rtables (and it doesn't make sense) .
A path to fix the issue is to not generate summary_data and try to print it with rtables if there is no categorical data.
Here is the app to reproduce this problem:
library(teal.modules.general)
library("teal.data")
## Data reproducible code ----
data <- within(teal_data(), {
library("random.cdisc.data")
ADSL <- radsl(seed = 1)
ADRS <- radrs(ADSL, seed = 1)
ADLB <- radlb(ADSL, seed = 1)
ADLBPCA <- ADLB %>%
dplyr::select(USUBJID, STUDYID, SEX, ARMCD, AVAL, AVISIT, PARAMCD) %>%
tidyr::pivot_wider(
values_from = "AVAL",
names_from = c("PARAMCD", "AVISIT"),
names_sep = " - "
)
})
join_keys(data) <- default_cdisc_join_keys[c("ADSL", "ADRS", "ADLB", "ADLBPCA")]
ADLB <- data$ADLB
init(
data = data,
modules = modules(
tm_outliers(
"Outliers",
outlier_var = data_extract_spec(
dataname = "ADLB",
select = select_spec(
choices = variable_choices(ADLB, c("AVAL", "CHG", "PCHG", "BASE")),
selected = "AVAL",
multiple = FALSE,
fixed = FALSE
)
),
categorical_var = data_extract_spec(
dataname = "ADLB",
select = select_spec(
choices = variable_choices(ADLB, c("PARAM", "PARAMCD")),
selected = NULL,
multiple = FALSE,
fixed = FALSE
)
)
)
)
) |> runApp()
The app will open but will crash when trying to add the card of the module on the report.
This is when code fails with an error message on the terminal:
sessionInfo()
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct.
Contribution Guidelines
- I agree to follow this project's Contribution Guidelines.
Security Policy
- I agree to follow this project's Security Policy.