lyt <-basic_table(title ="Extent of Exposure by Race: Safety-Evaluable Patients",main_footer ="* Person time is the sum of exposure across all patients in unit: days.",show_colcounts =TRUE) %>%summarize_patients_exposure_in_cols(var ="AVAL", col_split =TRUE,.labels =c(n_patients ="Patients", sum_exposure ="Person time*") ) %>%analyze_patients_exposure_in_cols(var ="RACE",col_split =FALSE ) %>%append_topleft(c("", obj_label(adex$RACE)))result <-build_table(lyt, df = anl, alt_counts_df = adsl_f)result
Extent of Exposure by Race: Safety-Evaluable Patients
————————————————————————————————————————————————————————————————————————
Patients Person time*
Race (N=400) (N=400)
————————————————————————————————————————————————————————————————————————
Total patients numbers/person time 217 (54.2%) 20641
ASIAN 113 (28.2%) 10239
BLACK OR AFRICAN AMERICAN 48 (12.0%) 4481
WHITE 40 (10.0%) 4237
AMERICAN INDIAN OR ALASKA NATIVE 14 (3.5%) 1566
MULTIPLE 1 (0.2%) 58
NATIVE HAWAIIAN OR OTHER PACIFIC ISLANDER 1 (0.2%) 60
OTHER 0 (0.0%) 0
UNKNOWN 0 (0.0%) 0
————————————————————————————————————————————————————————————————————————
* Person time is the sum of exposure across all patients in unit: days.
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::cadsladex <- random.cdisc.data::cadex# Ensure character variables are converted to factors and empty strings and NAs are explicit missing levels.adsl <-df_explicit_na(adsl)adex <-df_explicit_na(adex)# Simulate ADEX records with PARAMCD == "TDURD" as they are not in the sample dataset.set.seed(1)adex2 <- adex %>%distinct(USUBJID, .keep_all =TRUE) %>%mutate(PARAMCD ="TDURD",PARAM ="Overall duration (days)",AVAL =sample(x =seq(1, 200), size =n(), replace =TRUE) ) %>%bind_rows(adex)# Now pre-processing steps are carried out.anl <- adex2 %>%filter( PARAMCD =="TDURD", PARCAT2 =="Drug A", SAFFL =="Y" ) %>%mutate()adsl_f <- adsl %>%filter(adsl$SAFFL =="Y")
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.