The tm_t_summary requires that the input dataset cannot contain observations with empty ARM, otherwise the above ERROR will be reported. I tried to filter the data with filter = teal_slices(), but even though it's locked in the filter panel, it still shows an error.
A little confused about how to properly filter data for tm_t_summary. Many thanks!
I made more tests and also learned filter_panel_api, t it's true that teal_slice(dataname = "ADSL",expr="ARMCD=='ARM A'",id = "valid_arm", title = "Test NullARM") can pass the filter to tm_t_summary(); But it's a special case, if ADSL$ARM contains null value, this module tm_t_summary() failed to process it, wish for your further confirmation?
What is your question?
The
tm_t_summary
requires that the input dataset cannot contain observations with emptyARM
, otherwise the above ERROR will be reported. I tried to filter the data withfilter = teal_slices()
, but even though it's locked in the filter panel, it still shows an error.A little confused about how to properly filter data for
tm_t_summary
. Many thanks!I made more tests and also learned
filter_panel_api
, t it's true thatteal_slice(dataname = "ADSL",expr="ARMCD=='ARM A'",id = "valid_arm", title = "Test NullARM")
can pass the filter totm_t_summary()
; But it's a special case, if ADSL$ARM contains null value, this moduletm_t_summary()
failed to process it, wish for your further confirmation?Click to toggle contents of `Full code`, Copy and run directly
``` library(teal.modules.general) library(teal.modules.clinical) options(shiny.useragg = FALSE) ## Data reproducible code ---- data <- within(teal_data(), { library(random.cdisc.data) library(dplyr) library(nestcolor) # optional libraries library(sparkline) ADSL <- radsl(seed = 1) ADSL <- ADSL %>% mutate(ARM = as.character(ARM)) %>% mutate(ARM = ifelse(ARM == "C: Combination", "", ARM)) %>% mutate(ARM = as.factor(ARM)) }) datanames <- c("ADSL") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] ## App header and footer ---- nest_logo <- "https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png" app_source <- "https://github.com/insightsengineering/teal.gallery/tree/main/safety" gh_issues_page <- "https://github.com/insightsengineering/teal.gallery/issues" header <- tags$span( style = "display: flex; align-items: center; justify-content: space-between; margin: 10px 0 10px 0;", tags$span("My first teal app", style = "font-size: 30px;"), tags$span( style = "display: flex; align-items: center;", tags$img(src = nest_logo, alt = "NEST logo", height = "45px", style = "margin-right:10px;"), tags$span(style = "font-size: 24px;", "NEST @ Roche") ) ) footer <- tags$p( "This teal app is brought to you by the NEST Team at Roche/Genentech. For more information, please visit:", tags$a(href = app_source, target = "_blank", "Source Code"), ", ", tags$a(href = gh_issues_page, target = "_blank", "Report Issues") ) ## Setup App app <- teal::init( data = data, title = build_app_title("Safety Analysis Teal Demo App", nest_logo), header = header, footer = footer, # Set initial filter state as safety-evaluable population filter = teal_slices( count_type = "all", teal_slice(dataname = "ADSL", varname = "SAFFL", selected = "Y"), teal_slice(dataname = "ADSL",expr="ARMCD=='ARM A'",id = "valid_arm", title = "Test NullARM"), teal_slice(dataname = "ADSL", varname = "AGE"), module_specific = TRUE, mapping = list( `Demographic Table` = "valid_arm" ) ), modules = modules( tm_front_page( label = "App Info", header_text = c("Info about input data source" = "This app uses CDISC ADaM datasets randomly generated by `random.cdisc.data` R packages"), tables = list(`NEST packages used in this demo app` = data.frame( Packages = c( "teal.modules.general", "teal.modules.clinical", "random.cdisc.data" ) )) ), tm_data_table("Data Table"), tm_variable_browser("Variable Browser"), tm_t_summary( label = "Demographic Table", dataname = "ADSL", arm_var = choices_selected("ARM", "ARM"), summarize_vars = choices_selected( c("SEX", "RACE", "AGE"), selected = c("SEX", "AGE", "RACE") ) ) ) ) shinyApp(app$ui, app$server) ```Code of Conduct
Contribution Guidelines
Security Policy