# parameters in columnsadat03_stats <-c("n", "mean", "sd", "median", "min", "max", "cv", "geom_mean", "count_fraction")adat03_lbls <-c(n ="Total Number\nof Measurable\n Samples",mean ="Mean",sd ="SD",median ="Median",min ="Minimum",max ="Maximum",cv ="CV (%)",geom_mean ="Geometric Mean",count_fraction =paste0("Samples with\nConcentration\n≤ ", max_conc, "μg/mL"))adat03_fmts <-c(n ="xx.",mean =format_sigfig(3),sd =format_sigfig(3),median =format_sigfig(3),min =format_sigfig(3),max =format_sigfig(3),cv ="xx.x",geom_mean =format_sigfig(3),count_fraction = format_count_fraction)afun_list <-lapply(1:9,function(i) make_afun(s_summary, .stats = adat03_stats[i], .formats = adat03_fmts[i], .labels ="Overall"))# lyt creationlyt <-basic_table() %>%split_rows_by(var ="ARM",label_pos ="topleft",split_label ="Treatment Group",split_fun = drop_split_levels,section_div ="" ) %>%add_rowcounts() %>%split_rows_by(var ="VISIT",label_pos ="topleft",split_label ="Visit",split_fun = drop_split_levels,child_labels ="hidden" ) %>%analyze_vars_in_cols(vars =c(rep("AVAL", 8), "AVAL_LT"),.stats = adat03_stats,.labels = adat03_lbls,.formats = adat03_fmts ) %>%analyze_colvars( afun_list,nested =FALSE,extra_args =list(".labels"="Overall") )result <-build_table(lyt, anl, alt_counts_df = adsl)main_title(result) <-paste("Summary of Serum Concentrations (μg/mL) at Timepoints Where ADA Samples Were Collected and Analyzed\n Protocol:", unique(adab$PARCAT1)[1])subtitles(result) <-paste("Analyte:", unique(adab$PARAMCD)[1])fnotes_at_path(result, rowpath =NULL, colpath =c("multivars", "AVAL")) <-"Refers to the total no. of measurable ADA samples that have a corresponding measurable drug concentration sample (i.e. results with valid numeric values and LTRs). LTR results on post-dose samples are replaced by aaa µg/mL i.e. half of MQC value."fnotes_at_path(result, rowpath =NULL, colpath =c("multivars", "AVAL_LT")) <-"In validation, the assay was able to detect yyy ng/mL of surrogate ADA in the presence of zzz µg/mL of [drug]. BLQ = Below Limit of Quantitation, LTR = Lower than Reportable, MQC = Minimum Quantifiable Concentration, ADA = Anti-Drug Antibodies (is also referred to as ATA, or Anti-Therapeutic Antibodies). RXXXXXXX is also known as [drug]"result
Summary of Serum Concentrations (μg/mL) at Timepoints Where ADA Samples Were Collected and Analyzed
Protocol: A: Drug X Antibody
Analyte: R1800000
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Total Number Samples with
Treatment Group of Measurable Concentration
Visit Samples {1} Mean SD Median Minimum Maximum CV (%) Geometric Mean ≤ 15μg/mL {2}
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
A: Drug X (N=536)
Day 1 402 0 0 0 0 0 NA NA 402 (100%)
Day 2 134 16.2 1.63 16.2 12.6 19.9 10.0 16.1 39 (29.1%)
C: Combination (N=792)
Day 1 528 0 0 0 0 0 NA NA 528 (100%)
Day 2 264 24.7 8.65 22.5 12.6 39.5 35.0 23.2 28 (10.6%)
Overall 1328 6.54 11.0 0 0 39.5 167.5 NA 997 (75.1%)
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
{1} - Refers to the total no. of measurable ADA samples that have a corresponding measurable drug concentration sample (i.e. results with valid numeric values and LTRs). LTR results on post-dose samples are replaced by aaa µg/mL i.e. half of MQC value.
{2} - In validation, the assay was able to detect yyy ng/mL of surrogate ADA in the presence of zzz µg/mL of [drug]. BLQ = Below Limit of Quantitation, LTR = Lower than Reportable, MQC = Minimum Quantifiable Concentration, ADA = Anti-Drug Antibodies (is also referred to as ATA, or Anti-Therapeutic Antibodies). RXXXXXXX is also known as [drug]
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
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::cadsladab <- random.cdisc.data::cadabadpc <- random.cdisc.data::cadpc# Ensure character variables are converted to factors and empty strings and NAs are explicit missing levels.adsl <-df_explicit_na(adsl)adab <-df_explicit_na(adab)adpc <-df_explicit_na(adpc)# Adjust zzz parametermax_conc <-15adpc <- adpc %>%select(USUBJID, NFRLT, AVAL, AVALU, AVALCAT1)anl <- adab %>%filter(., PARAM =="ADA interpreted per sample result") %>%select(-AVAL, AVALC, AVALU)anl <-merge(anl, adpc, by =c("USUBJID", "NFRLT")) %>%mutate(AVAL_LT =ifelse(AVAL <= max_conc, TRUE, FALSE))