-
-
Notifications
You must be signed in to change notification settings - Fork 13
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_distribution
(#801)
Part of insightsengineering/teal#1370 <details><summary> Working Example </summary> ```r pkgload::load_all("../teal") pkgload::load_all("../teal.modules.general") footnote_dec <- teal_transform_module( label = "Footnote", ui = function(id) shiny::textInput(shiny::NS(id, "footnote"), "Footnote", value = "I am a good decorator"), server = function(id, data) { moduleServer(id, function(input, output, session) { logger::log_info("🟢 Footnote called to action!", namespace = "teal.modules.general") reactive( within( data(), { footnote_str <- footnote plot <- plot + ggplot2::labs(caption = footnote_str) }, footnote = input$footnote ) ) }) } ) table_dup_dec <- teal_transform_module( server = make_teal_transform_server( expression( logger::log_info("🔴 Table dup being called to action!", namespace = "teal.modules.general"), summary_table <- rbind(summary_table, summary_table), if (exists("test_table")) test_table <- rbind(test_table, test_table, test_table) ) ) ) # CDISC data example data <- teal_data() data <- within(data, { ADSL <- rADSL }) join_keys(data) <- default_cdisc_join_keys[names(data)] vars1 <- choices_selected( variable_choices(data[["ADSL"]], c("ARM", "COUNTRY", "SEX")), selected = NULL ) app <- init( data = data, modules = modules( tm_g_distribution( decorators = list(footnote_dec, table_dup_dec), dist_var = data_extract_spec( dataname = "ADSL", select = select_spec( choices = variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")), selected = "BMRKR1", multiple = FALSE, fixed = FALSE ) ), strata_var = data_extract_spec( dataname = "ADSL", filter = filter_spec( vars = vars1, multiple = TRUE ) ), group_var = data_extract_spec( dataname = "ADSL", filter = filter_spec( vars = vars1, multiple = TRUE ) ) ) ) ) if (interactive()) { shinyApp(app$ui, app$server) } ``` </details> --------- Signed-off-by: André Veríssimo <[email protected]>
- Loading branch information
1 parent
612bb06
commit 006b374
Showing
2 changed files
with
96 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.