B: Placebo A: Drug X
Baseline Risk Factors Total n n Responders Response (%) n Responders Response (%) Odds Ratio 95% CI
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
All Patients 268 134 84 62.7% 134 100 74.6% 1.75 (1.04, 2.95)
Sex
F 161 82 48 58.5% 79 61 77.2% 2.40 (1.21, 4.76)
M 107 52 36 69.2% 55 39 70.9% 1.08 (0.47, 2.48)
Stratification Factor 2
S1 140 67 38 56.7% 73 56 76.7% 2.51 (1.22, 5.20)
S2 128 67 46 68.7% 61 44 72.1% 1.18 (0.55, 2.53)
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.
B: Placebo A: Drug X
Baseline Risk Factors Total n n Responders Response (%) n Responders Response (%) Odds Ratio 95% CI
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
All Patients 268 134 84 62.7% 134 100 74.6% 1.75 (1.04, 2.95)
Sex
M 107 52 36 69.2% 55 39 70.9% 1.08 (0.47, 2.48)
F 161 82 48 58.5% 79 61 77.2% 2.40 (1.21, 4.76)
Stratification Factor 1
C 94 45 33 73.3% 49 37 75.5% 1.12 (0.44, 2.83)
B 92 45 26 57.8% 47 32 68.1% 1.56 (0.66, 3.66)
A 82 44 25 56.8% 38 31 81.6% 3.37 (1.22, 9.28)
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.
B: Placebo A: Drug X
Baseline Risk Factors Total n n Responders Response (%) n Responders Response (%) Odds Ratio 90% CI p-value (Chi-Squared Test)
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
All Patients 268 134 84 62.7% 134 100 74.6% 1.75 (1.13, 2.72) 0.0351
Sex
F 161 82 48 58.5% 79 61 77.2% 2.40 (1.35, 4.27) 0.0113
M 107 52 36 69.2% 55 39 70.9% 1.08 (0.54, 2.17) 0.8497
Stratification Factor 2
S1 140 67 38 56.7% 73 56 76.7% 2.51 (1.37, 4.63) 0.0119
S2 128 67 46 68.7% 61 44 72.1% 1.18 (0.62, 2.24) 0.6674
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.
B: Placebo A: Drug X
Baseline Risk Factors Total n n Responders Response (%) n Responders Response (%) Odds Ratio 95% CI
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
All Patients 268 134 47 35.1% 134 60 44.8% 1.50 (0.92, 2.45)
Sex
F 161 82 25 30.5% 79 39 49.4% 2.22 (1.17, 4.24)
M 107 52 22 42.3% 55 21 38.2% 0.84 (0.39, 1.83)
Stratification Factor 2
S1 140 67 21 31.3% 73 31 42.5% 1.62 (0.81, 3.24)
S2 128 67 26 38.8% 61 29 47.5% 1.43 (0.71, 2.89)
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(tern)library(dplyr)adsl <- random.cdisc.data::cadsladrs <- random.cdisc.data::cadrs# Ensure character variables are converted to factors and empty strings and NAs are explicit missing levels.adsl <-df_explicit_na(adsl)adrs <-df_explicit_na(adrs)adsl <- adsl %>%select(STUDYID, USUBJID, ARM, SEX, RACE, STRATA1, STRATA2)adrs <- adrs %>%filter(PARAMCD =="INVET") %>%select(STUDYID, USUBJID, PARAMCD, AVALC)anl <-inner_join(adsl, adrs, by =c("STUDYID", "USUBJID"))anl_labels <-var_labels(anl)anl <- anl %>%filter(ARM %in%c("A: Drug X", "B: Placebo")) %>%mutate(# Reorder levels of factor to make the placebo group the reference arm.ARM =relevel(ARM, ref ="B: Placebo") %>%droplevels() ) %>%droplevels() %>%mutate(rsp = AVALC %in%c("CR", "PR"))var_labels(anl) <-c(anl_labels, rsp ="Is Response")
# Use table, embedded in response forest plot module.library(teal.modules.clinical)## Data reproducible codedata <-teal_data()data <-within(data, { ADSL <- random.cdisc.data::cadsl ADRS <- random.cdisc.data::cadrs# Ensure character variables are converted to factors and empty strings and NAs are explicit missing levels. ADSL <-df_explicit_na(ADSL) ADRS <-df_explicit_na(ADRS)})datanames <-c("ADSL", "ADRS")datanames(data) <- datanames
Warning: `datanames<-()` was deprecated in teal.data 0.6.1.
ℹ invalid to use `datanames()<-` or `names()<-` on an object of class
`teal_data`. See ?names.teal_data
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://pharmaverse.r-universe.dev", getOption("webr_pkg_repos")))# -- APP CODE --# Use table, embedded in response forest plot module.library(teal.modules.clinical)## Data reproducible codedata <- teal_data()data <- within(data, { ADSL <- random.cdisc.data::cadsl ADRS <- random.cdisc.data::cadrs # Ensure character variables are converted to factors and empty strings and NAs are explicit missing levels. ADSL <- df_explicit_na(ADSL) ADRS <- df_explicit_na(ADRS)})datanames <- c("ADSL", "ADRS")datanames(data) <- datanamesjoin_keys(data) <- default_cdisc_join_keys[datanames]## Reusable Configuration For ModulesADSL <- data[["ADSL"]]ADRS <- data[["ADRS"]]arm_ref_comp <- list( ARM = list( ref = "B: Placebo", comp = c("A: Drug X", "C: Combination") ), ARMCD = list( ref = "ARM B", comp = c("ARM A", "ARM C") ))## Setup Appapp <- init( data = data, modules = modules( tm_g_forest_rsp( label = "Forest Response", dataname = "ADRS", arm_var = choices_selected( variable_choices(ADSL, c("ARM", "ARMCD")), "ARMCD" ), arm_ref_comp = arm_ref_comp, paramcd = choices_selected( value_choices(ADRS, "PARAMCD", "PARAM"), "BESRSPI" ), subgroup_var = choices_selected( variable_choices(ADSL, names(ADSL)), c("SEX") ), strata_var = choices_selected( variable_choices(ADSL, c("STRATA1", "STRATA2")), "STRATA2" ), plot_height = c(600L, 200L, 2000L) ) ))shinyApp(app$ui, app$server)