WebR is a tool allowing you to run R code in the web browser. Modify the code below and click run to see the results. Alternatively, copy the code and click here to open WebR in a new tab.
WebR is a tool allowing you to run R code in the web browser. Modify the code below and click run to see the results. Alternatively, copy the code and click here to open WebR in a new tab.
Code
library(tern)library(dplyr)adsl <- random.cdisc.data::cadsladae <- random.cdisc.data::cadae# Ensure character variables are converted to factors and empty strings and NAs are explicit missing levels.adsl <-df_explicit_na(adsl)adae <-df_explicit_na(adae)
The desired frequency is specified in prune_freq. For illustration, frequency is set to \(\geq\) 35%.
Code
library(teal.modules.clinical)## Data reproducible codedata <-teal_data()data <-within(data, { ADSL <- random.cdisc.data::cadsl ADAE <- random.cdisc.data::cadae# Ensure character variables are converted to factors and empty strings and NAs are explicit missing levels. ADSL <-df_explicit_na(ADSL) ADAE <-df_explicit_na(ADAE)})datanames <-c("ADSL", "ADAE")datanames(data) <- datanamesjoin_keys(data) <- default_cdisc_join_keys[datanames]## Reusable Configuration For ModulesADAE <- data[["ADAE"]]## Setup Appapp <-init(data = data,modules =modules(tm_t_events(label ="Adverse Event Table",dataname ="ADAE",arm_var =choices_selected(c("ARM", "ARMCD"), "ARM"),llt =choices_selected(choices =variable_choices(ADAE, c("AETERM", "AEDECOD")),selected =c("AEDECOD") ),hlt =choices_selected(choices =variable_choices(ADAE, c("AEBODSYS", "AESOC")),selected =NULL ),add_total =TRUE,event_type ="adverse event",prune_freq =35, ) ))shinyApp(app$ui, app$server)
Experimental use!
shinylive allow you to modify to run shiny application entirely in the web browser. Modify the code below and click re-run the app to see the results. The performance is slighly worse and some of the features (e.g. downloading) might not work at all.
#| '!! shinylive warning !!': |#| shinylive does not work in self-contained HTML documents.#| Please set `embed-resources: false` in your metadata.#| standalone: true#| viewerHeight: 800#| editorHeight: 200#| components: [viewer, editor]#| layout: vertical# -- WEBR HELPERS --options(webr_pkg_repos = c("r-universe" = "https://insightsengineering.r-universe.dev", getOption("webr_pkg_repos")))# -- APP CODE --library(teal.modules.clinical)## Data reproducible codedata <- teal_data()data <- within(data, { ADSL <- random.cdisc.data::cadsl ADAE <- random.cdisc.data::cadae # Ensure character variables are converted to factors and empty strings and NAs are explicit missing levels. ADSL <- df_explicit_na(ADSL) ADAE <- df_explicit_na(ADAE)})datanames <- c("ADSL", "ADAE")datanames(data) <- datanamesjoin_keys(data) <- default_cdisc_join_keys[datanames]## Reusable Configuration For ModulesADAE <- data[["ADAE"]]## Setup Appapp <- init( data = data, modules = modules( tm_t_events( label = "Adverse Event Table", dataname = "ADAE", arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"), llt = choices_selected( choices = variable_choices(ADAE, c("AETERM", "AEDECOD")), selected = c("AEDECOD") ), hlt = choices_selected( choices = variable_choices(ADAE, c("AEBODSYS", "AESOC")), selected = NULL ), add_total = TRUE, event_type = "adverse event", prune_freq = 35, ) ))shinyApp(app$ui, app$server)