A: Drug X B: Placebo C: Combination
(N=134) (N=134) (N=132)
—————————————————————————————————————————————————————————————————————————————————————
Total patient-years at risk 162.4 103.9 172.6
Number of adverse events observed 78 104 67
AE rate per 100 patient-years 48.03 100.14 38.82
95% CI (37.37, 58.69) (80.89, 119.38) (29.53, 48.12)
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.
The type of confidence interval can be specified through the conf_type argument.
A: Drug X B: Placebo C: Combination
(N=134) (N=134) (N=132)
—————————————————————————————————————————————————————————————————————————————————————
Total patient-years at risk 162.4 103.9 172.6
Number of adverse events observed 78 104 67
AE rate per 100 patient-years 48.03 100.14 38.82
95% CI (37.97, 59.94) (81.82, 121.34) (30.09, 49.30)
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.
Code
library(dplyr)library(tern)adsl <- random.cdisc.data::cadsladaette <- random.cdisc.data::cadaette# Ensure character variables are converted to factors and empty strings and NAs are explicit missing levels.adsl <-df_explicit_na(adsl)adaette <-df_explicit_na(adaette)anl <- adaette %>% dplyr::filter(PARAM =="Time to first occurrence of any adverse event") %>% dplyr::mutate(is_event = CNSR ==0) %>% dplyr::mutate(n_events =as.integer(is_event))
library(teal.modules.clinical)## Data reproducible codedata <-teal_data()data <-within(data, {library(dplyr) ADSL <- random.cdisc.data::cadsl ADAETTE <- random.cdisc.data::cadaette# Ensure character variables are converted to factors and empty strings and NAs are explicit missing levels. ADSL <-df_explicit_na(ADSL) ADAETTE <-df_explicit_na(ADAETTE) ADAETTE <- ADAETTE %>%filter(PARAMCD %in%c("AETTE1", "AETTE2", "AETTE3")) %>%mutate(is_event = CNSR ==0) %>%mutate(n_events =as.integer(is_event))})datanames <-c("ADSL", "ADAETTE")datanames(data) <- datanamesjoin_keys(data) <- default_cdisc_join_keys[datanames]## Reusable Configuration For ModulesADSL <- data[["ADSL"]]ADAETTE <- data[["ADAETTE"]]## Setup Appapp <-init(data = data,modules =modules(tm_t_events_patyear(label ="AE rate adjusted for patient-years at risk Table",dataname ="ADAETTE",arm_var =choices_selected(choices =variable_choices(ADSL, c("ARM", "ARMCD")),selected ="ARMCD" ),paramcd =choices_selected(choices =value_choices(ADAETTE, "PARAMCD", "PARAM"),selected ="AETTE1" ),events_var =choices_selected(choices =variable_choices(ADAETTE, "n_events"),selected ="n_events",fixed =TRUE ) ) ))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, { library(dplyr) ADSL <- random.cdisc.data::cadsl ADAETTE <- random.cdisc.data::cadaette # Ensure character variables are converted to factors and empty strings and NAs are explicit missing levels. ADSL <- df_explicit_na(ADSL) ADAETTE <- df_explicit_na(ADAETTE) ADAETTE <- ADAETTE %>% filter(PARAMCD %in% c("AETTE1", "AETTE2", "AETTE3")) %>% mutate(is_event = CNSR == 0) %>% mutate(n_events = as.integer(is_event))})datanames <- c("ADSL", "ADAETTE")datanames(data) <- datanamesjoin_keys(data) <- default_cdisc_join_keys[datanames]## Reusable Configuration For ModulesADSL <- data[["ADSL"]]ADAETTE <- data[["ADAETTE"]]## Setup Appapp <- init( data = data, modules = modules( tm_t_events_patyear( label = "AE rate adjusted for patient-years at risk Table", dataname = "ADAETTE", arm_var = choices_selected( choices = variable_choices(ADSL, c("ARM", "ARMCD")), selected = "ARMCD" ), paramcd = choices_selected( choices = value_choices(ADAETTE, "PARAMCD", "PARAM"), selected = "AETTE1" ), events_var = choices_selected( choices = variable_choices(ADAETTE, "n_events"), selected = "n_events", fixed = TRUE ) ) ))shinyApp(app$ui, app$server)