diff --git a/adam/adpc.R b/adam/adpc.R index f69fad0..87cb164 100644 --- a/adam/adpc.R +++ b/adam/adpc.R @@ -9,6 +9,7 @@ library(metatools) library(xportr) library(pharmaversesdtm) library(pharmaverseadam) +library(reactable) ## ----r echo=TRUE-------------------------------------------------------------- # ---- Load Specs for Metacore ---- @@ -58,6 +59,8 @@ pc_dates <- pc %>% NFRLT = if_else(PCTPTNUM < 0, 0, PCTPTNUM), .after = USUBJID ) +reactable(pc_dates) + ## ----r------------------------------------------------------------------------ ex_dates <- ex %>% derive_vars_merged( @@ -98,6 +101,8 @@ ex_dates <- ex %>% derive_vars_dtm_to_dt(exprs(ASTDTM)) %>% derive_vars_dtm_to_dt(exprs(AENDTM)) +reactable(ex_dates) + ## ----r------------------------------------------------------------------------ ex_exp <- ex_dates %>% create_single_dose_dataset( @@ -132,6 +137,8 @@ ex_exp <- ex_dates %>% derive_vars_dtm_to_tm(exprs(AENDTM)) %>% derive_vars_dy(reference_date = TRTSDT, source_vars = exprs(ADT)) +reactable(ex_exp) + ## ----r------------------------------------------------------------------------ adpc_first_dose <- pc_dates %>% derive_vars_merged( @@ -151,6 +158,8 @@ adpc_first_dose <- pc_dates %>% AVISIT = paste("Day", AVISITN), ) +reactable(adpc_first_dose) + ## ----r------------------------------------------------------------------------ adpc_prev <- adpc_first_dose %>% derive_vars_joined( @@ -186,6 +195,8 @@ adpc_next <- adpc_prev %>% check_type = "none" ) +reactable(adpc_prev) + ## ----r------------------------------------------------------------------------ adpc_nom_prev <- adpc_next %>% derive_vars_joined( @@ -272,6 +283,8 @@ adpc_arrlt <- bind_rows(adpc_nom_next, ex_exp) %>% derive_vars_dtm_to_dt(exprs(PCRFTDTM)) %>% derive_vars_dtm_to_tm(exprs(PCRFTDTM)) +reactable(adpc_arrlt) + ## ----r------------------------------------------------------------------------ # Derive Nominal Relative Time from Reference Dose (NRRLT) @@ -353,6 +366,8 @@ adpc_aval <- adpc_nrrlt %>% SRCSEQ = coalesce(PCSEQ, EXSEQ) ) +reactable(adpc_aval) + ## ----r------------------------------------------------------------------------ dtype <- adpc_aval %>% filter(NFRLT > 0 & NXRLT == 0 & EVID == 0 & !is.na(AVISIT_next)) %>% @@ -374,6 +389,8 @@ dtype <- adpc_aval %>% derive_vars_dtm_to_dt(exprs(PCRFTDTM)) %>% derive_vars_dtm_to_tm(exprs(PCRFTDTM)) +reactable(dtype) + ## ----r------------------------------------------------------------------------ adpc_dtype <- bind_rows(adpc_aval, dtype) %>% arrange(STUDYID, USUBJID, BASETYPE, ADTM, NFRLT) %>% @@ -452,6 +469,8 @@ adpc <- adpc_prefinal %>% order_cols(metacore) %>% # Orders the columns according to the spec sort_by_key(metacore) # Sorts the rows by the sort keys +reactable(adpc) + ## ----r------------------------------------------------------------------------ dir <- tempdir() # Change to whichever directory you want to save the dataset in diff --git a/adam/adpc.qmd b/adam/adpc.qmd index 3c2ca8c..688fefe 100644 --- a/adam/adpc.qmd +++ b/adam/adpc.qmd @@ -28,6 +28,7 @@ library(metatools) library(xportr) library(pharmaversesdtm) library(pharmaverseadam) +library(reactable) ``` ## Next Load Specifications for Metacore @@ -98,6 +99,8 @@ pc_dates <- pc %>% DRUG = PCTEST, NFRLT = if_else(PCTPTNUM < 0, 0, PCTPTNUM), .after = USUBJID ) + +reactable(pc_dates) ``` ### Get Dosing Information @@ -145,6 +148,8 @@ ex_dates <- ex %>% # Derive dates from date/times derive_vars_dtm_to_dt(exprs(ASTDTM)) %>% derive_vars_dtm_to_dt(exprs(AENDTM)) + +reactable(ex_dates) ``` ### Expand Dosing Records @@ -186,6 +191,8 @@ ex_exp <- ex_dates %>% derive_vars_dtm_to_tm(exprs(ASTDTM)) %>% derive_vars_dtm_to_tm(exprs(AENDTM)) %>% derive_vars_dy(reference_date = TRTSDT, source_vars = exprs(ADT)) + +reactable(ex_exp) ``` ### Find First Dose @@ -212,6 +219,8 @@ adpc_first_dose <- pc_dates %>% AVISITN = NFRLT %/% 24 + 1, AVISIT = paste("Day", AVISITN), ) + +reactable(adpc_first_dose) ``` ### Find Previous Dose and Next Dose @@ -254,6 +263,8 @@ adpc_next <- adpc_prev %>% mode = "first", check_type = "none" ) + +reactable(adpc_prev) ``` ### Find Previous and Next Nominal Dose @@ -354,6 +365,8 @@ adpc_arrlt <- bind_rows(adpc_nom_next, ex_exp) %>% derive_vars_dtm_to_tm(exprs(FANLDTM)) %>% derive_vars_dtm_to_dt(exprs(PCRFTDTM)) %>% derive_vars_dtm_to_tm(exprs(PCRFTDTM)) + +reactable(adpc_arrlt) ``` ### Derive Nominal Reference @@ -449,6 +462,8 @@ adpc_aval <- adpc_nrrlt %>% SRCVAR = "SEQ", SRCSEQ = coalesce(PCSEQ, EXSEQ) ) + +reactable(adpc_aval) ``` ### Derive DTYPE Copy Records @@ -477,6 +492,8 @@ dtype <- adpc_aval %>% ) %>% derive_vars_dtm_to_dt(exprs(PCRFTDTM)) %>% derive_vars_dtm_to_tm(exprs(PCRFTDTM)) + +reactable(dtype) ``` ### Combine Original and DTYPE Copy @@ -593,6 +610,8 @@ adpc <- adpc_prefinal %>% check_ct_data(metacore) %>% # Checks all variables with CT only contain values within the CT order_cols(metacore) %>% # Orders the columns according to the spec sort_by_key(metacore) # Sorts the rows by the sort keys + +reactable(adpc) ``` ## Apply Labels and Formats with xportr