data <- teal_data()
data <- within(data, {
library(dplyr)
library(formatters)
ADSL <- tmc_ex_adsl
ADLB <- tmc_ex_adlb %>%
mutate(
ONTRTFL = case_when(
AVISIT %in% c("SCREENING", "BASELINE") ~ "",
TRUE ~ "Y"
) %>% with_label("On Treatment Record Flag")
)
})
datanames <- c("ADSL", "ADLB")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
app <- init(
data = data,
modules = modules(
tm_t_abnormality(
label = "Abnormality Table",
dataname = "ADLB",
arm_var = choices_selected(
choices = variable_choices(data[["ADSL"]], subset = c("ARM", "ARMCD")),
selected = "ARM"
),
add_total = FALSE,
by_vars = choices_selected(
choices = variable_choices(data[["ADLB"]], subset = c("LBCAT", "PARAM", "AVISIT")),
selected = c("LBCAT", "PARAM"),
keep_order = TRUE
),
baseline_var = choices_selected(
variable_choices(data[["ADLB"]], subset = "BNRIND"),
selected = "BNRIND", fixed = TRUE
),
grade = choices_selected(
choices = variable_choices(data[["ADLB"]], subset = "ANRIND"),
selected = "ANRIND",
fixed = TRUE
),
abnormal = list(low = "LOW", high = "HIGH"),
exclude_base_abn = FALSE
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
Run the code above in your browser using DataLab