B: Placebo C: Combination
MedDRA SOC and Preferred Term (N=134) (N=132)
———————————————————————————————————————————————————————————
Total number of deaths 70 (52.2%) 75 (56.8%)
cl D.1 / dcd D.1.1.1.1 42 (31.3%) 51 (38.6%)
cl B.1 / dcd B.1.1.1.1 49 (36.6%) 43 (32.6%)
Experimental use!
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.
A: Drug X B: Placebo C: Combination
MedDRA SOC and Preferred Term (N=134) (N=134) (N=132)
———————————————————————————————————————————————————————————————————————
Total number of deaths 0 70 (52.2%) 75 (56.8%)
cl D.1 / dcd D.1.1.1.1 0 42 (31.3%) 51 (38.6%)
cl B.1 / dcd B.1.1.1.1 0 49 (36.6%) 43 (32.6%)
Experimental use!
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.
For illustrative purposes, we will pre-process AESDTH in ADAE so there are no deaths in arm A and concatenate AEBODSYS and AEDECOD as per GDSR output standards for AET07.
Code
library(dplyr)library(tern)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)adae_f <- adae %>%mutate(AESDTH =as.character(AESDTH), # characterizing AESDTH for next stepAESDTH =case_when( ARM =="A: Drug X"~NA_character_, # For demonstration purpose only,TRUE~ AESDTH ), # make "A: Drug X" as the arm without AE leading to deathAESDTH =as.factor(AESDTH),SOC_PT =factor(paste(AEBODSYS, "/", AEDECOD)) ) %>%filter(AESDTH =="Y") %>%mutate(ARM =droplevels(ARM))
library(teal.modules.clinical)## Data reproducible codedata <-teal_data()data <-within(data, {library(dplyr) 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) ADSL <- ADSL %>%mutate(DTHFL =case_when(!is.na(DTHDT) ~"Y",TRUE~"" ) ) %>%col_relabel(DTHFL ="Subject Death Flag" ) ADAE <- ADAE %>%mutate(AESDTH =as.character(AESDTH), # characterizing AESDTH for next stepAESDTH =case_when( ARM =="A: Drug X"~NA_character_, # For demonstration purpose only,TRUE~ AESDTH ), # make "A: Drug X" as the arm without AE leading to deathAESDTH =as.factor(AESDTH),SOC_PT =factor(paste(AEBODSYS, "/", AEDECOD)) ) %>%filter(AESDTH =="Y") %>%mutate(ARM =droplevels(ARM)) %>%col_relabel(SOC_PT ="MedDRA SOC and Preferred Term")})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", "SOC_PT")),selected =c("SOC_PT") ),hlt =choices_selected(choices =variable_choices(ADAE, c("AETERM", "AEDECOD", "SOC_PT")),selected =NULL ),add_total =FALSE,event_type ="adverse event" ) ))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.
#| standalone: true#| viewerHeight: 800#| editorHeight: 200#| components: [viewer, editor]#| layout: vertical# -- WEBR HELPERS --options(webr_pkg_repos = c("r-universe" = "https://pharmaverse.r-universe.dev", getOption("webr_pkg_repos")))# -- APP CODE --library(teal.modules.clinical)## Data reproducible codedata <- teal_data()data <- within(data, { library(dplyr) 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) ADSL <- ADSL %>% mutate( DTHFL = case_when( !is.na(DTHDT) ~ "Y", TRUE ~ "" ) ) %>% col_relabel( DTHFL = "Subject Death Flag" ) ADAE <- ADAE %>% mutate( AESDTH = as.character(AESDTH), # characterizing AESDTH for next step AESDTH = case_when( ARM == "A: Drug X" ~ NA_character_, # For demonstration purpose only, TRUE ~ AESDTH ), # make "A: Drug X" as the arm without AE leading to death AESDTH = as.factor(AESDTH), SOC_PT = factor(paste(AEBODSYS, "/", AEDECOD)) ) %>% filter(AESDTH == "Y") %>% mutate(ARM = droplevels(ARM)) %>% col_relabel(SOC_PT = "MedDRA SOC and Preferred Term")})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", "SOC_PT")), selected = c("SOC_PT") ), hlt = choices_selected( choices = variable_choices(ADAE, c("AETERM", "AEDECOD", "SOC_PT")), selected = NULL ), add_total = FALSE, event_type = "adverse event" ) ))shinyApp(app$ui, app$server)