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_t_crosstable
(#806)
Part of insightsengineering/teal#1370 <details><summary> Working Example </summary> ````r devtools::load_all("../teal") devtools::load_all(".") split_by_decorator <- teal_transform_module( label = "Footnote", ui = function(id) shiny::textInput( shiny::NS(id, "text"), "Insert row", "Hello World!" ), server = function(id, data) { moduleServer(id, function(input, output, session) { logger::log_info("🟢 Text called to action!", namespace = "teal.modules.general") reactive( within( data(), { table <- table %>% insert_rrow(rrow(text)) }, text = input$text ) ) }) } ) # CDISC data example data <- teal_data() data <- within(data, { ADSL <- rADSL }) join_keys(data) <- default_cdisc_join_keys[names(data)] app <- init( data = data, modules = modules( tm_t_crosstable( label = "Cross Table", x = data_extract_spec( dataname = "ADSL", select = select_spec( label = "Select variable:", choices = variable_choices(data[["ADSL"]], subset = function(data) { idx <- !vapply(data, inherits, logical(1), c("Date", "POSIXct", "POSIXlt")) return(names(data)[idx]) }), selected = "COUNTRY", multiple = TRUE, ordered = TRUE, fixed = FALSE ) ), y = data_extract_spec( dataname = "ADSL", select = select_spec( label = "Select variable:", choices = variable_choices(data[["ADSL"]], subset = function(data) { idx <- vapply(data, is.factor, logical(1)) return(names(data)[idx]) }), selected = "SEX", multiple = FALSE, fixed = FALSE ) ), decorators = list(split_by_decorator) ) ) ) if (interactive()) { shinyApp(app$ui, app$server) } ```` </details> --------- Signed-off-by: Marcin <[email protected]> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: André Veríssimo <[email protected]>
- Loading branch information