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_forest_tte
(#1264)
Part of insightsengineering/teal#1371 <details><summary> Working Example </summary> ```r devtools::load_all("../teal.reporter") devtools::load_all("../teal") devtools::load_all(".") library(nestcolor) library(dplyr) caption_decorator <- function(annotation = "I am a good decorator", var_to_decorate = "plot") { teal_transform_module( label = "Annotation", ui = function(id) shiny::textInput(shiny::NS(id, "annotation"), "Annotation", value = annotation), server = make_teal_transform_server( substitute({ var_to_decorate <- cowplot::add_sub(var_to_decorate, annotation) }, env = list(var_to_decorate = as.name(var_to_decorate))) ) ) } data <- teal_data() data <- within(data, { ADSL <- tmc_ex_adsl ADTTE <- tmc_ex_adtte ADSL$RACE <- droplevels(ADSL$RACE) %>% with_label("Race") }) join_keys(data) <- default_cdisc_join_keys[names(data)] ADSL <- data[["ADSL"]] ADTTE <- data[["ADTTE"]] arm_ref_comp <- list( ARM = list( ref = "B: Placebo", comp = c("A: Drug X", "C: Combination") ), ARMCD = list( ref = "ARM B", comp = c("ARM A", "ARM C") ) ) app <- init( data = data, modules = modules( tm_g_forest_tte( label = "Forest Survival", dataname = "ADTTE", arm_var = choices_selected( variable_choices(ADSL, c("ARM", "ARMCD")), "ARMCD" ), arm_ref_comp = arm_ref_comp, paramcd = choices_selected( value_choices(ADTTE, "PARAMCD", "PARAM"), "OS" ), subgroup_var = choices_selected( variable_choices(ADSL, names(ADSL)), c("BMRKR2", "SEX") ), strata_var = choices_selected( variable_choices(ADSL, c("STRATA1", "STRATA2")), "STRATA2" ), decorators = list(caption_decorator()) ) ) ) shinyApp(app$ui, app$server) ``` </details>
- Loading branch information