library(metalite) library(metalite.sl)
The exposure duration analysis aims to provide table to summarize by each identified duration category. The development of exposure duration analysis involves functions:
meta_sl_exposure_example
: build the metadata (meta
object) for analysis.prepare_exp_duration
: prepare analysis raw datasets.format_exp_duration
: prepare analysis outdata with proper format.rtf_exp_duration
: transfer (mock) output dataset to RTF table.knitr::include_graphics("pdf/exp0duration.pdf")
There are two steps in meta_sl_exposure_example
function in order to build the metadata (meta
object): processing the ADaM dataset and save meta information for A&R reporting.
Step1: ADEXSUM, the ADaM dataset for Drug Exposrue Summary Data, is utilized to:
upcase(trim(left(paramcd))) = "TRTDUR"
.adexsum$AVAL
for all participants.adexsum$EXDURGR
i.e.">=1 day", ">=7 days",">=28 days", ">=12 weeks" and ">=24 weeks".adsl <- r2rtf::r2rtf_adsl adexsum <- data.frame(USUBJID = adsl$USUBJID) adexsum$TRTA <- factor(adsl$TRT01A, levels = c("Placebo", "Xanomeline Low Dose", "Xanomeline High Dose"), labels = c("Placebo", "Low Dose", "High Dose") ) adexsum$APERIODC <- "Base" adexsum$APERIOD <- 1 set.seed(123) # Set a seed for reproducibility adexsum$AVAL <- sample(x = 0:(24 * 7), size = length(adexsum$USUBJID), replace = TRUE) adexsum$EXDURGR <- "not treated" adexsum$EXDURGR[adexsum$AVAL >= 1] <- ">=1 day" adexsum$EXDURGR[adexsum$AVAL >= 7] <- ">=7 days" adexsum$EXDURGR[adexsum$AVAL >= 28] <- ">=28 days" adexsum$EXDURGR[adexsum$AVAL >= 12 * 7] <- ">=12 weeks" adexsum$EXDURGR[adexsum$AVAL >= 24 * 7] <- ">=24 weeks" adexsum$EXDURGR <- factor(adexsum$EXDURGR, levels = c("not treated", ">=1 day", ">=7 days", ">=28 days", ">=12 weeks", ">=24 weeks") ) unique(adexsum$EXDURGR)
Step2: Save analysis plan and metadata(parameter and analysis) information, then build meta object.
plan <- metalite::plan( analysis = "exp_dur", population = "apat", observation = "apat", parameter = "expdur" ) meta <- metalite::meta_adam( population = adexsum, observation = adexsum ) |> metalite::define_plan(plan) |> metalite::define_population( name = "apat", group = "TRTA", subset = quote(APERIOD == 1 & AVAL > 0) ) |> metalite::define_parameter( name = "expdur", var = "AVAL", label = "Exposure Duration (Days)", vargroup = "EXDURGR" ) |> metalite::define_analysis( name = "exp_dur", title = "Summary of Exposure Duration", label = "exposure duration table" ) |> metalite::meta_build()
The input of the function prepare_exp_duration()
is a meta
object created by the metalite package. The resulting output comprises a collection of raw datasets for analysis and reporting.
outdata <- prepare_exp_duration(meta) outdata
Number of participants in population
outdata$n[, 1:5]
Number of participants in each duration category
charn <- data.frame(outdata$char_n[1]) head(charn[, 1:5], 6)
Proportion of participants in each duration category
charp <- data.frame(outdata$char_prop[1]) head(charp[, 1:5], 6)
Statistical summary of exposure duration for each treatment
chars <- data.frame(outdata$char_n[1]) tail(chars[, 1:5], 8)
format_exp_duration
to prepare analysis dataset before generate RTF output
tbl <- format_exp_duration(outdata, display_col = c("n", "prop", "total")) head(tbl$tbl)
rtf_exp_duration
to generate RTF output
outdata <- format_exp_duration(outdata, display_col = c("n", "prop", "total")) |> rtf_exp_duration( source = "Source: [CDISCpilot: adam-adexsum]", path_outdata = tempfile(fileext = ".Rdata"), path_outtable = "outtable/exp0duration.rtf" )
knitr::include_graphics("pdf/exp0duration.pdf")
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.