Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce decorators for
tm_g_km
(#1254)
Part of insightsengineering/teal#1371 <details><summary> Working Example </summary> ```r devtools::load_all("../teal") devtools::load_all(".") library(nestcolor) data <- teal_data() data <- within(data, { ADSL <- tmc_ex_adsl ADTTE <- tmc_ex_adtte }) join_keys(data) <- default_cdisc_join_keys[names(data)] ADSL <- data[["ADSL"]] ADTTE <- data[["ADTTE"]] arm_ref_comp <- list( ACTARMCD = list( ref = "ARM B", comp = c("ARM A", "ARM C") ), ARM = list( ref = "B: Placebo", comp = c("A: Drug X", "C: Combination") ) ) change_theme_decorator <- function(default_check = TRUE, .var_to_replace = "plot") { teal_transform_module( label = "Theme", server = make_teal_transform_server( substitute({ .var_to_replace <- .var_to_replace + ggplot2::theme_void() }, env = list(.var_to_replace = as.name(.var_to_replace)) ) ) ) } app <- init( data = data, modules = modules( tm_g_km( label = "Kaplan-Meier Plot", dataname = "ADTTE", arm_var = choices_selected( variable_choices(ADSL, c("ARM", "ARMCD", "ACTARMCD")), "ARM" ), paramcd = choices_selected( value_choices(ADTTE, "PARAMCD", "PARAM"), "OS" ), arm_ref_comp = arm_ref_comp, strata_var = choices_selected( variable_choices(ADSL, c("SEX", "BMRKR2")), "SEX" ), facet_var = choices_selected( variable_choices(ADSL, c("SEX", "BMRKR2")), NULL ), decorators = list(plot = change_theme_decorator(TRUE, "plot")) ) ) ) if (interactive()) { shinyApp(app$ui, app$server) } ``` </details> --------- Co-authored-by: André Veríssimo <[email protected]>
- Loading branch information