From e501a6061f0b28dcdd46893275e55967bbfbe347 Mon Sep 17 00:00:00 2001 From: "David J. Bosak" Date: Wed, 6 Sep 2023 21:43:11 -0400 Subject: [PATCH] Example updates. --- docs/articles/sassy-ae.html | 43 +++-- docs/articles/sassy-dm.html | 53 +++--- docs/articles/sassy-ds.html | 39 ++-- docs/articles/sassy-figure.html | 17 +- docs/articles/sassy-figureby.html | 9 +- docs/articles/sassy-pfigure.html | 151 ++++++++------- docs/articles/sassy-plisting.html | 296 ++++++++---------------------- docs/articles/sassy-profile.html | 156 ++++++---------- docs/pkgdown.yml | 2 +- vignettes/sassy-ae.Rmd | 1 - vignettes/sassy-dm.Rmd | 1 - vignettes/sassy-ds.Rmd | 1 - vignettes/sassy-figure.Rmd | 1 - vignettes/sassy-figureby.Rmd | 1 - vignettes/sassy-pfigure.Rmd | 149 ++++++++------- vignettes/sassy-plisting.Rmd | 294 ++++++++--------------------- vignettes/sassy-profile.Rmd | 154 ++++++---------- 17 files changed, 514 insertions(+), 854 deletions(-) diff --git a/docs/articles/sassy-ae.html b/docs/articles/sassy-ae.html index a5392ef..efbfafe 100644 --- a/docs/articles/sassy-ae.html +++ b/docs/articles/sassy-ae.html @@ -162,7 +162,6 @@

Program
 library(sassy)
-library(procs)
 
 options("logr.autolog" = TRUE, 
         "logr.notes" = FALSE,
@@ -191,13 +190,13 @@ 

Program put("Filter DM data") datastep(sdtm.DM, - keep = v(USUBJID, ARM, ARMCD), + keep = v(USUBJID, ARM, ARMCD), where = expression(ARM != "SCREEN FAILURE"), {}) -> dm put("Get population counts") -proc_freq(dm, tables = ARM, +proc_freq(dm, tables = ARM, output = long, - options = v(nopercent, nonobs)) -> arm_pop + options = v(nopercent, nonobs)) -> arm_pop put ("Create lookup for AE severity") sevn <- c(MILD = 1, MODERATE = 2, SEVERE = 3) |> put() @@ -205,8 +204,8 @@

Programput("Prepare table data") datastep(sdtm.AE, merge = dm, merge_by = "USUBJID", - merge_in = v(inA, inB), - keep = v(USUBJID, ARM, AESEV, AESEVN, AESOC, AEDECOD), + merge_in = v(inA, inB), + keep = v(USUBJID, ARM, AESEV, AESEVN, AESOC, AEDECOD), where = expression(inB == 1 & inA != 0), { AESEVN <- fapply(AESEV, sevn) @@ -228,8 +227,8 @@

Program put("Get SOC Frequencies") -proc_freq(ae_sub, - tables = v(AESOC * AESEV), +proc_freq(ae_sub, + tables = v(AESOC * AESEV), by = "ARM") -> ae_soc @@ -237,7 +236,7 @@

Programdatastep(ae_soc, format = fc, rename = list(VAR1 = "VAR", CAT1 = "CAT"), - drop = v(VAR2, CNT, PCT), + drop = v(VAR2, CNT, PCT), { VARORD <- 1 CNTPCT <- fapply2(CNT, PCT) @@ -247,27 +246,27 @@

Program put("Pivot SOC frequencies") -proc_transpose(ae_soc_c, id = v(BY, CAT2), +proc_transpose(ae_soc_c, id = v(BY, CAT2), var = CNTPCT, - copy = v(VAR, VARORD), + copy = v(VAR, VARORD), by = CAT) -> ae_soc_t put("Get PT Frequencies") -proc_freq(ae_sub, +proc_freq(ae_sub, tables = "AEDECOD * AESEV", by = "ARM", options = nonobs) -> ae_pt put("Get unique SOC and PT combinations") -proc_sort(ae_sub, keep = v(AESOC, AEDECOD), - by = v(AESOC, AEDECOD), options = nodupkey) -> evnts +proc_sort(ae_sub, keep = v(AESOC, AEDECOD), + by = v(AESOC, AEDECOD), options = nodupkey) -> evnts put("Combine columns for PT") datastep(ae_pt, format = fc, rename = list(VAR1 = "VAR", CAT1 = "CAT"), - drop = v(VAR2, CNT, PCT), + drop = v(VAR2, CNT, PCT), { VARORD <- 2 CNTPCT <- fapply2(CNT, PCT) @@ -277,9 +276,9 @@

Program put("Pivot PT frequencies") -proc_transpose(ae_pt_c, id = v(BY, CAT2), +proc_transpose(ae_pt_c, id = v(BY, CAT2), var = CNTPCT, - copy = v(VAR, VARORD), + copy = v(VAR, VARORD), by = CAT) -> ae_pt_t nms <- names(ae_soc_t) @@ -293,21 +292,21 @@

Programput("Stack SOC and PT counts") datastep(ae_soc_t, set = ae_pt_tj, keep = c("VAR", "CAT", "CAT2", "VARORD", - find.names(ae_pt_tj, "ARM*")), {}) -> ae_soc_pt + find.names(ae_pt_tj, "ARM*")), {}) -> ae_soc_pt -aefinal <- proc_sort(ae_soc_pt, by = v( CAT, VARORD, CAT2)) +aefinal <- proc_sort(ae_soc_pt, by = v( CAT, VARORD, CAT2)) # All Adverse Events ------------------------------------------------------ put("Get frequencies for all events") -proc_freq(ae_sub, tables = "AESEV", by = v(ARM)) -> allfreq +proc_freq(ae_sub, tables = "AESEV", by = v(ARM)) -> allfreq put("Combine all events.") datastep(allfreq, format = fc, - drop = v(N, CNT, PCT), + drop = v(N, CNT, PCT), { CNTPCT <- fapply2(CNT, PCT) @@ -317,7 +316,7 @@

Program }) -> allfreqm put("Prepare data for reporting") -proc_transpose(allfreqm, id = v(BY, CAT), +proc_transpose(allfreqm, id = v(BY, CAT), var = CNTPCT, copy = VAR, name = CAT) -> allfreqt diff --git a/docs/articles/sassy-dm.html b/docs/articles/sassy-dm.html index 2811111..73d6e2f 100644 --- a/docs/articles/sassy-dm.html +++ b/docs/articles/sassy-dm.html @@ -163,7 +163,6 @@

Program
 library(sassy)
-library(procs)
 
 # Prepare Log -------------------------------------------------------------
 
@@ -252,24 +251,24 @@ 

Program put("Get ARM population counts") -proc_freq(adsl, tables = ARM, +proc_freq(adsl, tables = ARM, output = long, - options = v(nopercent, nonobs)) -> arm_pop + options = v(nopercent, nonobs)) -> arm_pop # Age Summary Block ------------------------------------------------------- sep("Create summary statistics for age") put("Call means procedure to get summary statistics for age") -proc_means(adsl, var = AGE, - stats = v(n, mean, std, median, q1, q3, min, max), +proc_means(adsl, var = AGE, + stats = v(n, mean, std, median, q1, q3, min, max), by = ARM, - options = v(notype, nofreq)) -> age_stats + options = v(notype, nofreq)) -> age_stats put("Combine stats") datastep(age_stats, format = fc, - drop = find.names(age_stats, start = 4), + drop = find.names(age_stats, start = 4), { `Mean (SD)` <- fapply2(MEAN, STD) Median <- MEDIAN @@ -280,7 +279,7 @@

Program }) -> age_comb put("Transpose ARMs into columns") -proc_transpose(age_comb, +proc_transpose(age_comb, var = names(age_comb), copy = VAR, id = BY, name = LABEL) -> age_trans @@ -312,7 +311,7 @@

Programsep("Create frequency counts for SEX") put("Get sex frequency counts") -proc_freq(adsl, tables = SEX, +proc_freq(adsl, tables = SEX, by = ARM, options = nonobs) -> sex_freq @@ -321,7 +320,7 @@

Programdatastep(sex_freq, format = fc, rename = list(CAT = "LABEL"), - drop = v(CNT, PCT), + drop = v(CNT, PCT), { CNTPCT <- fapply2(CNT, PCT) @@ -329,7 +328,7 @@

Program }) -> sex_comb put("Transpose ARMs into columns") -proc_transpose(sex_comb, id = BY, +proc_transpose(sex_comb, id = BY, var = CNTPCT, copy = VAR, by = LABEL) -> sex_trans @@ -343,11 +342,11 @@

Program }) -> sex_cnts put("Sort by label") -proc_sort(sex_cnts, by = LABEL) -> sex_cnts +proc_sort(sex_cnts, by = LABEL) -> sex_cnts put("Get sex chisq") -proc_freq(adsl, tables = v(SEX * ARM), - options = v(chisq, notable)) -> sex_chisq +proc_freq(adsl, tables = v(SEX * ARM), + options = v(chisq, notable)) -> sex_chisq put("Combine chisq statistics") datastep(sex_chisq, @@ -370,7 +369,7 @@

Programsep("Create frequency counts for RACE") put("Get race frequency counts") -proc_freq(adsl, tables = RACE, +proc_freq(adsl, tables = RACE, by = ARM, options = nonobs) -> race_freq @@ -379,7 +378,7 @@

Programdatastep(race_freq, format = fc, rename = list(CAT = "LABEL"), - drop = v(CNT, PCT), + drop = v(CNT, PCT), { CNTPCT <- fapply2(CNT, PCT) @@ -387,7 +386,7 @@

Program }) -> race_comb put("Transpose ARMs into columns") -proc_transpose(race_comb, id = BY, var = CNTPCT, +proc_transpose(race_comb, id = BY, var = CNTPCT, copy = VAR, by = LABEL) -> race_trans put("Clean up") @@ -401,11 +400,11 @@

Program }) -> race_cnts put("Sort by label") -proc_sort(race_cnts, by = LABEL) -> race_cnts +proc_sort(race_cnts, by = LABEL) -> race_cnts put("Get race chisq") -proc_freq(adsl, tables = RACE * ARM, - options = v(chisq, notable)) -> race_chisq +proc_freq(adsl, tables = RACE * ARM, + options = v(chisq, notable)) -> race_chisq put("Combine chisq statistics") datastep(race_chisq, @@ -426,7 +425,7 @@

Program put("Get age group frequency counts") -proc_freq(adsl, +proc_freq(adsl, table = AGECAT, by = ARM, options = nonobs) -> ageg_freq @@ -434,7 +433,7 @@

Programput("Combine counts and percents and assign age group factor for sorting") datastep(ageg_freq, format = fc, - keep = v(VAR, LABEL, BY, CNTPCT), + keep = v(VAR, LABEL, BY, CNTPCT), { CNTPCT <- fapply2(CNT, PCT) LABEL <- factor(CAT, levels = levels(fc$AGECAT)) @@ -442,10 +441,10 @@

Program put("Sort by age group factor") -proc_sort(ageg_comb, by = v(BY, LABEL)) -> ageg_sort +proc_sort(ageg_comb, by = v(BY, LABEL)) -> ageg_sort put("Tranpose age group block") -proc_transpose(ageg_sort, +proc_transpose(ageg_sort, var = CNTPCT, copy = VAR, id = BY, @@ -457,8 +456,8 @@

Program {}) -> ageg_cnts put("Get ageg chisq") -proc_freq(adsl, tables = AGECAT * ARM, - options = v(chisq, notable)) -> ageg_chisq +proc_freq(adsl, tables = AGECAT * ARM, + options = v(chisq, notable)) -> ageg_chisq put("Combine chisq statistics") datastep(ageg_chisq, @@ -504,7 +503,7 @@

Program footnotes("Program: DM_Table.R", "NOTE: Denominator based on number of non-missing responses.", "{supsc('1')}Pearson's Chi-Square tests will be used for " - %p% "Categorical variables and ANOVA tests for continuous variables.") + %p% "Categorical variables and ANOVA tests for continuous variables.") rpt <- create_report(file.path(tmp, "example2.rtf"), output_type = "RTF", diff --git a/docs/articles/sassy-ds.html b/docs/articles/sassy-ds.html index 774d374..dcceafc 100644 --- a/docs/articles/sassy-ds.html +++ b/docs/articles/sassy-ds.html @@ -148,7 +148,6 @@

Program
 library(sassy)
-library(procs)
 library(stringr)
 
 options("logr.autolog" = TRUE, 
@@ -178,11 +177,11 @@ 

Programlib_load(sdtm) put("Prepare DM data") -datastep(sdtm.DM, keep = v(USUBJID, ARM), +datastep(sdtm.DM, keep = v(USUBJID, ARM), where = expression(ARM != "SCREEN FAILURE"), {}) -> dm_mod put("Prepare DS data") -datastep(sdtm.DS, keep = v(USUBJID, DSTERM, DSDECOD, DSCAT), +datastep(sdtm.DS, keep = v(USUBJID, DSTERM, DSDECOD, DSCAT), where = expression(DSCAT != "PROTOCOL MILESTONE"), {}) -> ds_mod put("Join DM with DS to get ARMs on DS") @@ -193,8 +192,8 @@

Program put("Get ARM population counts") -proc_freq(dm_mod, tables = ARM, output = long, - options = v(nonobs, nopercent)) -> arm_pop +proc_freq(dm_mod, tables = ARM, output = long, + options = v(nonobs, nopercent)) -> arm_pop # Prepare formats --------------------------------------------------------- @@ -224,16 +223,16 @@

Program# Disposition Groups ------------------------------------------------------ put("Create vector of final dataframe columns") -cols <- v(group, cat, catseq, `ARM A`, `ARM B`, `ARM C`, `ARM D`) |> put() +cols <- v(group, cat, catseq, `ARM A`, `ARM B`, `ARM C`, `ARM D`) |> put() put("Get group counts") -proc_freq(dmds, tables = DSDECOD, by = ARM) |> - datastep(keep = v(BY, CAT, CNTPCT), { +proc_freq(dmds, tables = DSDECOD, by = ARM) |> + datastep(keep = v(BY, CAT, CNTPCT), { CNTPCT <- fmt_cnt_pct(CNT, arm_pop[[BY]]) }) |> - proc_transpose(var = CNTPCT, by = CAT, id = BY) |> + proc_transpose(var = CNTPCT, by = CAT, id = BY) |> datastep(keep = cols, { @@ -252,14 +251,14 @@

Program TERMDECOD <- fapply(DSTERM, complete_fmt) }) |> - proc_freq(tables = v(DSDECOD * TERMDECOD), by = ARM) |> - datastep(keep = v(BY, CAT1, CAT2, CNTPCT), + proc_freq(tables = v(DSDECOD * TERMDECOD), by = ARM) |> + datastep(keep = v(BY, CAT1, CAT2, CNTPCT), { CNTPCT <- fmt_cnt_pct(CNT, arm_pop[[BY]]) }) |> - proc_transpose(var = CNTPCT, by = v(CAT1, CAT2), id = BY) |> + proc_transpose(var = CNTPCT, by = v(CAT1, CAT2), id = BY) |> datastep(keep = cols, { group = CAT1 @@ -274,14 +273,14 @@

Program TERMDECOD <- fapply(DSTERM, noncomp_fmt) }) |> - proc_freq(tables = v(DSDECOD * TERMDECOD), by = ARM) |> - datastep(keep = v(BY, CAT1, CAT2, CNTPCT), + proc_freq(tables = v(DSDECOD * TERMDECOD), by = ARM) |> + datastep(keep = v(BY, CAT1, CAT2, CNTPCT), { CNTPCT <- fmt_cnt_pct(CNT, arm_pop[[BY]]) }) |> - proc_transpose(var = CNTPCT, by = v(CAT1, CAT2), id = BY) |> + proc_transpose(var = CNTPCT, by = v(CAT1, CAT2), id = BY) |> datastep(keep = cols, { group = "NONCOMPLIANCE" @@ -296,14 +295,14 @@

Program TERMDECOD <- fapply(DSTERM, term_fmt) }) |> - proc_freq(tables = v(DSDECOD * TERMDECOD), by = ARM) |> - datastep(keep = v(BY, CAT1, CAT2, CNTPCT), + proc_freq(tables = v(DSDECOD * TERMDECOD), by = ARM) |> + datastep(keep = v(BY, CAT1, CAT2, CNTPCT), { CNTPCT <- fmt_cnt_pct(CNT, arm_pop[[BY]]) }) |> - proc_transpose(var = CNTPCT, by = v(CAT1, CAT2), id = BY) |> + proc_transpose(var = CNTPCT, by = v(CAT1, CAT2), id = BY) |> datastep(keep = cols, { group = "OTHER" @@ -317,7 +316,7 @@

Program { lblind <- ifelse(is.na(cat), TRUE, FALSE) }) |> - proc_sort(by = v(group, catseq, cat)) -> final + proc_sort(by = v(group, catseq, cat)) -> final # Report ------------------------------------------------------------------ @@ -329,7 +328,7 @@

Program borders = "all", width = 8.5, header_bold = TRUE) |> column_defaults(from = `ARM A`, to = `ARM D`, align = "center", width = 1) |> - stub(vars = v(group, cat), "Completion Status", + stub(vars = v(group, cat), "Completion Status", style = cell_style(bold = TRUE, indicator = "lblind")) |> define(group, blank_after = TRUE, dedupe = TRUE, format = group_fmt) |> diff --git a/docs/articles/sassy-figure.html b/docs/articles/sassy-figure.html index ab71b5b..650d3fd 100644 --- a/docs/articles/sassy-figure.html +++ b/docs/articles/sassy-figure.html @@ -161,7 +161,6 @@

Program
 library(ggplot2)
 library(sassy)
-library(procs)
 
 
 # Prepare Log -------------------------------------------------------------
@@ -199,7 +198,7 @@ 

Program put("Prepare data") -datastep(sdtm.DM, keep = v(USUBJID, SEX, AGE, ARM, AGECAT), +datastep(sdtm.DM, keep = v(USUBJID, SEX, AGE, ARM, AGECAT), where = expression(ARM != "SCREEN FAILURE"), { AGECAT <- fapply(AGE, agefmt) @@ -207,21 +206,21 @@

Program }) -> dm_mod put("Get population counts") -proc_freq(dm_mod, tables = ARM, - options = v(nonobs, nopercent)) -> arm_pop +proc_freq(dm_mod, tables = ARM, + options = v(nonobs, nopercent)) -> arm_pop -proc_freq(dm_mod, tables = SEX, - options = v(nonobs, nopercent)) -> sex_pop +proc_freq(dm_mod, tables = SEX, + options = v(nonobs, nopercent)) -> sex_pop -proc_freq(dm_mod, tables = AGECAT, - options = v(nonobs, nopercent)) -> agecat_pop +proc_freq(dm_mod, tables = AGECAT, + options = v(nonobs, nopercent)) -> agecat_pop put("Convert agecat to factor so rows will sort correctly") agecat_pop$CAT <- factor(agecat_pop$CAT, levels = levels(agefmt)) put("Sort agecat") -agecat_pop <- proc_sort(agecat_pop, by = CAT) +agecat_pop <- proc_sort(agecat_pop, by = CAT) # Create Plots ------------------------------------------------------------ diff --git a/docs/articles/sassy-figureby.html b/docs/articles/sassy-figureby.html index 999ba7b..3924808 100644 --- a/docs/articles/sassy-figureby.html +++ b/docs/articles/sassy-figureby.html @@ -157,7 +157,6 @@

Program
 library(ggplot2)
 library(sassy)
-library(procs)
 
 options("logr.autolog" = TRUE,
         "logr.notes" = FALSE)
@@ -186,7 +185,7 @@ 

Program put("Perform joins and basic filters") datastep(sdtm.DM, merge = sdtm.VS, merge_by = c("USUBJID" = "USUBJID"), - keep = v(USUBJID, ARMCD, ARM, VSTESTCD, VSTEST, VSORRES, VISITNUM, VISIT), + keep = v(USUBJID, ARMCD, ARM, VSTESTCD, VSTEST, VSORRES, VISITNUM, VISIT), where = expression(VSTESTCD %in% c("SYSBP", "DIABP", "PULSE", "TEMP", "RESP") & ARMCD != "SCRNFAIL"), {}) -> prep @@ -195,10 +194,10 @@

Program "WEEK 6","WEEK 8", "WEEK 12", "WEEK 16")) put("Group and summarize") -proc_means(prep, +proc_means(prep, var = VSORRES, - class = v(ARM, VSTEST, VISITNUM, VISIT), - options = v(nway, nofreq, notype), + class = v(ARM, VSTEST, VISITNUM, VISIT), + options = v(nway, nofreq, notype), stats = mean) |> datastep(where = expression(VISITNUM > 0 & VISITNUM < 20),{}) -> final diff --git a/docs/articles/sassy-pfigure.html b/docs/articles/sassy-pfigure.html index 0a57285..ba621bf 100644 --- a/docs/articles/sassy-pfigure.html +++ b/docs/articles/sassy-pfigure.html @@ -155,8 +155,8 @@

Program
-library(tidyverse)
-library(sassy)
+library(sassy)
+library(ggplot2)
 library(patchwork)
 
 
@@ -180,39 +180,35 @@ 

Program sep("Prepare Data") -# Define data library +put("Define data library") libname(sdtm, dir, "csv") -# Loads data into workspace +put("Load data into workspace") lib_load(sdtm) -# Prepare data -dm_mod <- sdtm.DM %>% - select(USUBJID, SEX, AGE, ARM) %>% - filter(ARM != "SCREEN FAILURE") %>% - datastep({ - - if (AGE >= 18 & AGE <= 24) - AGECAT = "18 to 24" - else if (AGE >= 25 & AGE <= 44) - AGECAT = "25 to 44" - else if (AGE >= 45 & AGE <= 64) - AGECAT <- "45 to 64" - else if (AGE >= 65) - AGECAT <- ">= 65" - - }) %>% put() +put("Prepare format") +agefmt <- value(condition(x >= 18 & x <= 24, "18 to 24"), + condition(x >= 25 & x <= 44, "25 to 44"), + condition(x >= 45 & x <= 64, "45 to 64"), + condition(x >= 65, ">= 65")) + +put("Prepare data") +datastep(sdtm.DM, + keep = v(USUBJID, SEX, AGE, ARM, AGECAT), + where = expression(ARM != "SCREEN FAILURE"), + { + + AGECAT = fapply(AGE, agefmt) + + }) -> dm_mod put("Convert agecat to factor it will sort correctly") -dm_mod$AGECAT <- factor(dm_mod$AGECAT, levels = c("18 to 24", - "25 to 44", - "45 to 64", - ">= 65")) +dm_mod$AGECAT <- factor(dm_mod$AGECAT, levels = levels(agefmt)) put("Split by ARM") dm_sub <- split(dm_mod, factor(dm_mod$ARM)) - + # Create Plots ------------------------------------------------------------ @@ -252,16 +248,16 @@

Programpth <- file.path(tmp, "output/example12.rtf") -plt <- create_plot(plts, 4.5, 7) %>% +plt <- create_plot(plts, 4.5, 7) |> titles("Figure 3.2", "Distribution of Subjects by Treatment Group", font_size = 11, bold = TRUE) -rpt <- create_report(pth, output_type = "RTF", font = "Arial") %>% - set_margins(top = 1, bottom = 1) %>% - page_header("Sponsor: Company", "Study: ABC") %>% - add_content(plt) %>% - footnotes("Program: DM_Figure.R") %>% +rpt <- create_report(pth, output_type = "RTF", font = "Arial") |> + set_margins(top = 1, bottom = 1) |> + page_header("Sponsor: Company", "Study: ABC") |> + add_content(plt) |> + footnotes("Program: DM_Figure.R") |> page_footer(paste0("Date Produced: ", fapply(Sys.time(), "%d%b%y %H:%M")), right = "Page [pg] of [tpg]") @@ -292,36 +288,70 @@

Log

Here is the log produced by the above combined plot example:

=========================================================================
-Log Path: C:/Users/dbosa/AppData/Local/Temp/RtmpqsSwWj/log/example12.log
-Program Path: C:/packages/sassy/vignettes/sassy-pfigure.Rmd
-Working Directory: C:/packages/sassy/vignettes
+Log Path: C:/Users/dbosa/AppData/Local/Temp/RtmpkNnsUE/log/example12.log
+Program Path: C:/packages/Testing/procs/ProcsCombinedFigure.R
+Working Directory: C:/packages/Testing/procs
 User Name: dbosa
-R Version: 4.2.1 (2022-06-23 ucrt)
+R Version: 4.3.1 (2023-06-16 ucrt)
 Machine: SOCRATES x86-64
-Operating System: Windows 10 x64 build 19044
+Operating System: Windows 10 x64 build 22621
 Base Packages: stats graphics grDevices utils datasets methods base Other
-Packages: tidylog_1.0.2 patchwork_1.1.2 reporter_1.3.8 libr_1.2.8 fmtr_1.5.9
-logr_1.3.3 common_1.0.5 sassy_1.0.8 forcats_0.5.2 stringr_1.4.1 dplyr_1.0.10
-purrr_0.3.5 readr_2.1.3 tidyr_1.2.1 tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.2
-Log Start Time: 2022-11-28 17:11:15
+Packages: tidylog_1.0.2 ggplot2_3.4.2 patchwork_1.1.3 procs_1.0.3
+reporter_1.4.1 libr_1.2.8 fmtr_1.5.9 logr_1.3.4 common_1.0.8 sassy_1.1.0
+Log Start Time: 2023-09-06 21:06:40.53712
 =========================================================================
 
 =========================================================================
 Prepare Data
 =========================================================================
 
-# library 'sdtm': 8 items
+Define data library
+
+# library 'sdtm': 7 items
 - attributes: csv not loaded
-- path: C:/Users/dbosa/AppData/Local/R/win-library/4.2/sassy/extdata
+- path: C:/Users/dbosa/AppData/Local/R/win-library/4.3/sassy/extdata
 - items:
+  Name Extension Rows Cols     Size        LastModified
+1   AE       csv  150   27  88.5 Kb 2023-08-07 17:51:40
+2   DM       csv   87   24  45.5 Kb 2023-08-07 17:51:40
+3   DS       csv  174    9  34.1 Kb 2023-08-07 17:51:40
+4   EX       csv   84   11  26.4 Kb 2023-08-07 17:51:40
+5   IE       csv    2   14  13.4 Kb 2023-08-07 17:51:40
+6   SV       csv  685   10  70.3 Kb 2023-08-07 17:51:40
+7   VS       csv 3358   17 467.4 Kb 2023-08-07 17:51:40
 
-lib_load: library 'sdtm' loaded
-
-select: dropped 20 variables (STUDYID, DOMAIN, SUBJID, RFSTDTC, RFENDTC, …)
+Load data into workspace
 
-filter: removed 2 rows (2%), 85 rows remaining
+lib_load: library 'sdtm' loaded
 
-datastep: columns increased from 4 to 5
+Prepare format
+
+# A user-defined format: 4 conditions
+  Name Type        Expression    Label Order
+1  obj    U x >= 18 & x <= 24 18 to 24    NA
+2  obj    U x >= 25 & x <= 44 25 to 44    NA
+3  obj    U x >= 45 & x <= 64 45 to 64    NA
+4  obj    U           x >= 65    >= 65    NA
+
+Prepare data
+
+datastep: columns decreased from 24 to 5
+
+# A tibble: 85 × 5
+   USUBJID    SEX     AGE ARM   AGECAT  
+   <chr>      <chr> <dbl> <chr> <chr>   
+ 1 ABC-01-049 M        39 ARM D 25 to 44
+ 2 ABC-01-050 M        47 ARM B 45 to 64
+ 3 ABC-01-051 M        34 ARM A 25 to 44
+ 4 ABC-01-052 F        45 ARM C 45 to 64
+ 5 ABC-01-053 F        26 ARM B 25 to 44
+ 6 ABC-01-054 M        44 ARM D 25 to 44
+ 7 ABC-01-055 F        47 ARM C 45 to 64
+ 8 ABC-01-056 M        31 ARM A 25 to 44
+ 9 ABC-01-113 M        74 ARM D >= 65   
+10 ABC-01-114 F        72 ARM B >= 65   
+# ℹ 75 more rows
+# ℹ Use `print(n = ...)` to see more rows
 
 Convert agecat to factor it will sort correctly
 
@@ -346,24 +376,7 @@ 

Log ========================================================================= # A report specification: 1 pages -- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpqsSwWj/output/example12.rtf' -- output_type: RTF -- units: inches -- orientation: landscape -- margins: top 1 bottom 1 left 1 right 1 -- line size/count: 9/36 -- page_header: left=Sponsor: Company right=Study: ABC -- footnote 1: 'Program: DM_Figure.R' -- page_footer: left=Date Produced: 28Nov22 17:11 center= right=Page [pg] of [tpg] -- content: -# A plot specification: -- height: 4.5 -- width: 7 -- title 1: 'Figure 3.2' -- title 2: 'Distribution of Subjects by Treatment Group' - -# A report specification: 1 pages -- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpqsSwWj/output/example12.rtf' +- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpkNnsUE/output/example12.rtf' - output_type: RTF - units: inches - orientation: landscape @@ -371,7 +384,7 @@

Log - line size/count: 9/36 - page_header: left=Sponsor: Company right=Study: ABC - footnote 1: 'Program: DM_Figure.R' -- page_footer: left=Date Produced: 28Nov22 17:11 center= right=Page [pg] of [tpg] +- page_footer: left=Date Produced: 06Sep23 21:06 center= right=Page [pg] of [tpg] - content: # A plot specification: - height: 4.5 @@ -383,11 +396,9 @@

Log lib_unload: library 'sdtm' unloaded -lib_unload: library 'sdtm' unloaded - ========================================================================= -Log End Time: 2022-11-28 17:11:43 -Log Elapsed Time: 0 00:00:27 +Log End Time: 2023-09-06 21:06:43.938549 +Log Elapsed Time: 0 00:00:03 =========================================================================

diff --git a/docs/articles/sassy-plisting.html b/docs/articles/sassy-plisting.html index bfa3d59..c13f248 100644 --- a/docs/articles/sassy-plisting.html +++ b/docs/articles/sassy-plisting.html @@ -164,8 +164,8 @@

Program
-library(tidyverse)
-library(sassy)
+library(sassy)
+library(procs)
 
 # Prepare Log -------------------------------------------------------------
 
@@ -239,12 +239,9 @@ 

Program }) -> vso put("Pivot vitals signs") -vsot <- vso |> - group_by(USUBJID, VISITNUM, VISIT) |> - pivot_wider(names_from = VSTESTCD, - values_from = VSCOMB) |> - ungroup() |> - arrange(USUBJID, VISITNUM) |> put() +proc_transpose(vso, id = VSTESTCD, var = VSCOMB, + by = v(USUBJID, VISITNUM, VISIT)) |> + proc_sort(by = v(USUBJID, VISITNUM)) -> vsot put("Assign and apply formats") @@ -359,252 +356,117 @@

Log

Here is the log produced by the above subject listing:

=========================================================================
-Log Path: C:/Users/dbosa/AppData/Local/Temp/RtmpeYEHwE/log/example11.log
-Program Path: C:/packages/Testing/example11.R
-Working Directory: C:/packages/Testing
+Log Path: C:/Users/dbosa/AppData/Local/Temp/RtmpkNnsUE/log/example12.log
+Program Path: C:/packages/Testing/procs/ProcsCombinedFigure.R
+Working Directory: C:/packages/Testing/procs
 User Name: dbosa
-R Version: 4.2.1 (2022-06-23 ucrt)
+R Version: 4.3.1 (2023-06-16 ucrt)
 Machine: SOCRATES x86-64
-Operating System: Windows 10 x64 build 19044
+Operating System: Windows 10 x64 build 22621
 Base Packages: stats graphics grDevices utils datasets methods base Other
-Packages: tidylog_1.0.2 reporter_1.3.7 libr_1.2.6 fmtr_1.5.9 logr_1.3.3
-sassy_1.0.8 forcats_0.5.2 stringr_1.4.0 dplyr_1.0.10 purrr_0.3.4 readr_2.1.2
-tidyr_1.2.0 tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.1 cranlogs_2.1.1
-common_1.0.5
-Log Start Time: 2022-10-09 19:18:43
+Packages: tidylog_1.0.2 ggplot2_3.4.2 patchwork_1.1.3 procs_1.0.3
+reporter_1.4.1 libr_1.2.8 fmtr_1.5.9 logr_1.3.4 common_1.0.8 sassy_1.1.0
+Log Start Time: 2023-09-06 21:06:40.53712
 =========================================================================
 
-=========================================================================
-Prepare formats
-=========================================================================
-
-# A user-defined format: 4 conditions
-  Name Type                       Expression                     Label Order
-1  obj    U                     x == "WHITE"                     White    NA
-2  obj    U x == "BLACK OR AFRICAN AMERICAN" Black or African American    NA
-3  obj    U x == "ASIAN OR PACIFIC ISLANDER" Asian or Pacific Islander    NA
-4  obj    U                             TRUE                     Other    NA
-
-# A user-defined format: 3 conditions
-  Name Type                    Expression                  Label Order
-1  obj    U x == "NOT HISPANIC OR LATINO" Not Hispanic or Latino    NA
-2  obj    U     x == "HISPANIC OR LATINO"     Hispanic or Latino    NA
-3  obj    U                          TRUE                Unknown    NA
-
-# A user-defined format: 5 conditions
-  Name Type   Expression                      Label Order
-1  obj    U x == "ARM A"                    Placebo    NA
-2  obj    U x == "ARM B"                  Drug 50mg    NA
-3  obj    U x == "ARM C"                 Drug 100mg    NA
-4  obj    U x == "ARM D"                 Competitor    NA
-5  obj    U         TRUE Not Treated/Screen Failure    NA
-
-# A user-defined format: 4 conditions
-  Name Type         Expression     Label Order
-1  obj    U   x == "BEATS/MIN"       bpm    NA
-2  obj    U x == "BREATHS/MIN" brths/min    NA
-3  obj    U           x == "C"        °C    NA
-4  obj    U        x == "mmHg"              NA
-
-# A user-defined format: 8 conditions
-  Name Type     Expression             Label Order
-1  obj    U   x == "DAY 1"             Day 1    NA
-2  obj    U  x == "WEEK 2"            Week 2    NA
-3  obj    U  x == "WEEK 4"            Week 4    NA
-4  obj    U  x == "WEEK 6"            Week 6    NA
-5  obj    U  x == "WEEK 8"            Week 8    NA
-6  obj    U x == "WEEK 12"           Week 12    NA
-7  obj    U x == "WEEK 16"           Week 16    NA
-8  obj    U           TRUE Early Termination    NA
-
-# A format catalog: 10 formats
-- $SEX: type V, 2 elements
-- $AGE: type S, "%d Years"
-- $RACE: type U, 4 conditions
-- $WEIGHT: type S, "%6.2f kg"
-- $EAR: type V, 2 elements
-- $DOSE: type S, "%4.2fug"
-- $ETHNIC: type U, 3 conditions
-- $ARMT: type U, 5 conditions
-- $UNITS: type U, 4 conditions
-- $VISIT: type U, 8 conditions
-
 =========================================================================
 Prepare Data
 =========================================================================
 
-# library 'sdtm': 8 items
+Define data library
+
+# library 'sdtm': 7 items
 - attributes: csv not loaded
-- path: C:/Users/dbosa/AppData/Local/R/win-library/4.2/sassy/extdata
+- path: C:/Users/dbosa/AppData/Local/R/win-library/4.3/sassy/extdata
 - items:
   Name Extension Rows Cols     Size        LastModified
-1   AE       csv  150   27  88.5 Kb 2022-09-05 10:57:47
-2   DA       csv 3587   18 528.2 Kb 2022-09-05 10:57:47
-3   DM       csv   87   24  45.5 Kb 2022-09-05 10:57:47
-4   DS       csv  174    9  34.1 Kb 2022-09-05 10:57:47
-5   EX       csv   84   11  26.4 Kb 2022-09-05 10:57:47
-6   IE       csv    2   14  13.4 Kb 2022-09-05 10:57:47
-7   SV       csv  685   10  70.3 Kb 2022-09-05 10:57:47
-8   VS       csv 3358   17 467.4 Kb 2022-09-05 10:57:47
+1   AE       csv  150   27  88.5 Kb 2023-08-07 17:51:40
+2   DM       csv   87   24  45.5 Kb 2023-08-07 17:51:40
+3   DS       csv  174    9  34.1 Kb 2023-08-07 17:51:40
+4   EX       csv   84   11  26.4 Kb 2023-08-07 17:51:40
+5   IE       csv    2   14  13.4 Kb 2023-08-07 17:51:40
+6   SV       csv  685   10  70.3 Kb 2023-08-07 17:51:40
+7   VS       csv 3358   17 467.4 Kb 2023-08-07 17:51:40
+
+Load data into workspace
 
 lib_load: library 'sdtm' loaded
 
-Format desired vital signs
-
-datastep: columns decreased from 17 to 5
-
-# A tibble: 2,764 × 5
-   USUBJID    VSTESTCD VSCOMB   VISITNUM VISIT  
-   <chr>      <chr>    <chr>       <dbl> <chr>  
- 1 ABC-01-049 DIABP    "76 "           1 DAY 1  
- 2 ABC-01-049 DIABP    "66 "           2 WEEK 2 
- 3 ABC-01-049 DIABP    "84 "           4 WEEK 4 
- 4 ABC-01-049 DIABP    "68 "           6 WEEK 6 
- 5 ABC-01-049 DIABP    "80 "           8 WEEK 8 
- 6 ABC-01-049 DIABP    "70 "          12 WEEK 12
- 7 ABC-01-049 DIABP    "70 "          16 WEEK 16
- 8 ABC-01-049 PULSE    "84 bpm"        1 DAY 1  
- 9 ABC-01-049 PULSE    "84 bpm"        2 WEEK 2 
-10 ABC-01-049 PULSE    "76 bpm"        4 WEEK 4 
-# … with 2,754 more rows
+Prepare format
+
+# A user-defined format: 4 conditions
+  Name Type        Expression    Label Order
+1  obj    U x >= 18 & x <= 24 18 to 24    NA
+2  obj    U x >= 25 & x <= 44 25 to 44    NA
+3  obj    U x >= 45 & x <= 64 45 to 64    NA
+4  obj    U           x >= 65    >= 65    NA
+
+Prepare data
+
+datastep: columns decreased from 24 to 5
+
+# A tibble: 85 × 5
+   USUBJID    SEX     AGE ARM   AGECAT  
+   <chr>      <chr> <dbl> <chr> <chr>   
+ 1 ABC-01-049 M        39 ARM D 25 to 44
+ 2 ABC-01-050 M        47 ARM B 45 to 64
+ 3 ABC-01-051 M        34 ARM A 25 to 44
+ 4 ABC-01-052 F        45 ARM C 45 to 64
+ 5 ABC-01-053 F        26 ARM B 25 to 44
+ 6 ABC-01-054 M        44 ARM D 25 to 44
+ 7 ABC-01-055 F        47 ARM C 45 to 64
+ 8 ABC-01-056 M        31 ARM A 25 to 44
+ 9 ABC-01-113 M        74 ARM D >= 65   
+10 ABC-01-114 F        72 ARM B >= 65   
+# ℹ 75 more rows
 # ℹ Use `print(n = ...)` to see more rows
 
-Pivot vitals signs
+Convert agecat to factor it will sort correctly
 
-group_by: 3 grouping variables (USUBJID, VISITNUM, VISIT)
+Split by ARM
 
-pivot_wider: reorganized (VSTESTCD, VSCOMB) into (DIABP, PULSE, RESP, SYSBP, TEMP) [was 2764x5, now 554x8]
+=========================================================================
+Create Plots
+=========================================================================
 
-ungroup: no grouping variables
+Create plot for ARM A
 
-# A tibble: 554 × 8
-   USUBJID    VISITNUM VISIT   DIABP PULSE  RESP         SYSBP  TEMP  
-   <chr>         <dbl> <chr>   <chr> <chr>  <chr>        <chr>  <chr> 
- 1 ABC-01-049        1 DAY 1   "76 " 84 bpm 20 brths/min "120 " 36.4°C
- 2 ABC-01-049        2 WEEK 2  "66 " 84 bpm 16 brths/min "128 " 36.6°C
- 3 ABC-01-049        4 WEEK 4  "84 " 76 bpm 16 brths/min "134 " 35.7°C
- 4 ABC-01-049        6 WEEK 6  "68 " 64 bpm 20 brths/min "100 " 36.5°C
- 5 ABC-01-049        8 WEEK 8  "80 " 84 bpm 16 brths/min "128 " 36.4°C
- 6 ABC-01-049       12 WEEK 12 "70 " 60 bpm 20 brths/min "120 " 36.6°C
- 7 ABC-01-049       16 WEEK 16 "70 " 72 bpm 18 brths/min "130 " 36.2°C
- 8 ABC-01-050        1 DAY 1   "78 " 68 bpm 18 brths/min "100 " 36.7°C
- 9 ABC-01-050        2 WEEK 2  "64 " 68 bpm 18 brths/min "110 " 36.7°C
-10 ABC-01-050        4 WEEK 4  "86 " 82 bpm 16 brths/min "128 " 36.6°C
-# … with 544 more rows
-# ℹ Use `print(n = ...)` to see more rows
+Create plot for ARM B
+
+Create plot for ARM C
 
-Assign and apply formats
-
-# A tibble: 87 × 24
-   STUDYID DOMAIN USUBJID    SUBJID RFSTDTC    RFENDTC RFXSTDTC RFXENDTC RFICDTC    RFPENDTC DTHDTC DTHFL SITEID
-   <chr>   <chr>  <chr>      <chr>  <date>     <date>  <lgl>    <lgl>    <date>     <date>   <lgl>  <lgl> <chr> 
- 1 ABC     DM     ABC-01-049 049    2006-11-07 NA      NA       NA       2006-10-25 NA       NA     NA    01    
- 2 ABC     DM     ABC-01-050 050    2006-11-02 NA      NA       NA       2006-10-25 NA       NA     NA    01    
- 3 ABC     DM     ABC-01-051 051    2006-11-02 NA      NA       NA       2006-10-25 NA       NA     NA    01    
- 4 ABC     DM     ABC-01-052 052    2006-11-06 NA      NA       NA       2006-10-31 NA       NA     NA    01    
- 5 ABC     DM     ABC-01-053 053    2006-11-08 NA      NA       NA       2006-11-01 NA       NA     NA    01    
- 6 ABC     DM     ABC-01-054 054    2006-11-16 NA      NA       NA       2006-11-07 NA       NA     NA    01    
- 7 ABC     DM     ABC-01-055 055    2006-12-06 NA      NA       NA       2006-10-31 NA       NA     NA    01    
- 8 ABC     DM     ABC-01-056 056    2006-11-28 NA      NA       NA       2006-11-21 NA       NA     NA    01    
- 9 ABC     DM     ABC-01-113 113    2006-12-05 NA      NA       NA       2006-11-28 NA       NA     NA    01    
-10 ABC     DM     ABC-01-114 114    2006-12-14 NA      NA       NA       2006-12-01 NA       NA     NA    01    
-# … with 77 more rows, and 11 more variables: BRTHDTC <date>, AGE <chr>, AGEU <chr>, SEX <chr>, RACE <chr>,
-#   ETHNIC <chr>, ARMCD <chr>, ARM <chr>, ACTARMCD <lgl>, ACTARM <lgl>, COUNTRY <lgl>
-# ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
-
-Prepare final data for reporting
-
-datastep: columns increased from 24 to 36
-
-# A tibble: 554 × 36
-   STUDYID DOMAIN USUBJID    SUBJID RFSTDTC    RFENDTC RFXSTDTC RFXENDTC RFICDTC    RFPENDTC DTHDTC DTHFL SITEID
-   <chr>   <chr>  <chr>      <chr>  <date>     <date>  <lgl>    <lgl>    <date>     <date>   <lgl>  <lgl> <chr> 
- 1 ABC     DM     ABC-01-049 049    2006-11-07 NA      NA       NA       2006-10-25 NA       NA     NA    01    
- 2 ABC     DM     ABC-01-049 049    2006-11-07 NA      NA       NA       2006-10-25 NA       NA     NA    01    
- 3 ABC     DM     ABC-01-049 049    2006-11-07 NA      NA       NA       2006-10-25 NA       NA     NA    01    
- 4 ABC     DM     ABC-01-049 049    2006-11-07 NA      NA       NA       2006-10-25 NA       NA     NA    01    
- 5 ABC     DM     ABC-01-049 049    2006-11-07 NA      NA       NA       2006-10-25 NA       NA     NA    01    
- 6 ABC     DM     ABC-01-049 049    2006-11-07 NA      NA       NA       2006-10-25 NA       NA     NA    01    
- 7 ABC     DM     ABC-01-049 049    2006-11-07 NA      NA       NA       2006-10-25 NA       NA     NA    01    
- 8 ABC     DM     ABC-01-050 050    2006-11-02 NA      NA       NA       2006-10-25 NA       NA     NA    01    
- 9 ABC     DM     ABC-01-050 050    2006-11-02 NA      NA       NA       2006-10-25 NA       NA     NA    01    
-10 ABC     DM     ABC-01-050 050    2006-11-02 NA      NA       NA       2006-10-25 NA       NA     NA    01    
-# … with 544 more rows, and 23 more variables: BRTHDTC <date>, AGE <chr>, AGEU <chr>, SEX <chr>, RACE <chr>,
-#   ETHNIC <chr>, ARMCD <chr>, ARM <chr>, ACTARMCD <lgl>, ACTARM <lgl>, COUNTRY <lgl>, VISITNUM <dbl>, VISIT <chr>,
-#   DIABP <chr>, PULSE <chr>, RESP <chr>, SYSBP <chr>, TEMP <chr>, BASELINE <chr>, BP <chr>, TREATMENT <chr>, PG <dbl>,
-#   PTCNT <dbl>
-# ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
+Create plot for ARM D
+
+Combine 4 plots into 1 using patchwork
 
 =========================================================================
-Create and Print Report
+Create and print report
 =========================================================================
 
-# A report specification: 29 pages
-- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpeYEHwE/example11.rtf'
+# A report specification: 1 pages
+- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpkNnsUE/output/example12.rtf'
 - output_type: RTF
 - units: inches
 - orientation: landscape
 - margins: top 1 bottom 1 left 1 right 1
-- line size/count: 9/37
-- page_header: left=Program:C:/packages/Testing/example11.R right=Draft
-- page_footer: left=Date: 09OCT2022 19:18:50 center=Archytas right=Page [pg] of [tpg]
-- content: 
-# A table specification:
-- data: tibble 'final' 554 rows 36 cols
-- show_cols: none
-- use_attributes: all
-- width: 9
-- stub: BASELINE TREATMENT 'Subject/Treatment' align='left' 
-- define: BASELINE dedupe='TRUE' 
-- define: TREATMENT 
-- define: VISIT 'Visit' 
-- define: TEMP 'Temperature' 
-- define: PULSE 'Pulse' 
-- define: RESP 'Respirations' 
-- define: BP 'Blood Pressure' 
-- define: USUBJID visible='FALSE' 
-- define: PG visible='FALSE' page_break='TRUE' 
-
-# A report specification: 29 pages
-- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpeYEHwE/example11.pdf'
-- output_type: PDF
-- units: inches
-- orientation: landscape
-- margins: top 1 bottom 1 left 1 right 1
-- line size/count: 9/42
-- page_header: left=Program:C:/packages/Testing/example11.R right=Draft
-- title 1: 'Study: ABC'
-- title 2: 'Appendix 10.2.6.1.2.1'
-- title 3: 'Source: DM, VS'
-- title 4: 'Subject Listing with Vital Signs by Visit¹'
-- title 5: 'All Randomized Patients'
-- footnote 1: '¹ Baseline through completion of study or early termination.'
-- footnote 2: 'Values flagged with † were excluded from the by-visit analysis in tables showing the qualitative test results.'
-- page_footer: left=Date: 09OCT2022 19:18:50 center=Archytas right=Page [pg] of [tpg]
+- line size/count: 9/36
+- page_header: left=Sponsor: Company right=Study: ABC
+- footnote 1: 'Program: DM_Figure.R'
+- page_footer: left=Date Produced: 06Sep23 21:06 center= right=Page [pg] of [tpg]
 - content: 
-# A table specification:
-- data: tibble 'final' 554 rows 36 cols
-- show_cols: none
-- use_attributes: all
-- width: 9
-- stub: BASELINE TREATMENT 'Subject/Treatment' align='left' 
-- define: BASELINE dedupe='TRUE' 
-- define: TREATMENT 
-- define: VISIT 'Visit' 
-- define: TEMP 'Temperature' 
-- define: PULSE 'Pulse' 
-- define: RESP 'Respirations' 
-- define: BP 'Blood Pressure' 
-- define: USUBJID visible='FALSE' 
-- define: PG visible='FALSE' page_break='TRUE' 
+# A plot specification: 
+- height: 4.5
+- width: 7
+- title 1: 'Figure 3.2'
+- title 2: 'Distribution of Subjects by Treatment Group'
 
 lib_sync: synchronized data in library 'sdtm'
 
 lib_unload: library 'sdtm' unloaded
 
 =========================================================================
-Log End Time: 2022-10-09 19:18:56
-Log Elapsed Time: 0 00:00:12
+Log End Time: 2023-09-06 21:06:43.938549
+Log Elapsed Time: 0 00:00:03
 =========================================================================
 

Next: Example 12: Combined diff --git a/docs/articles/sassy-profile.html b/docs/articles/sassy-profile.html index 94e8c7a..0a3986c 100644 --- a/docs/articles/sassy-profile.html +++ b/docs/articles/sassy-profile.html @@ -153,8 +153,7 @@

Programfmtr package.
-library(dplyr)
-library(sassy)
+library(sassy)
 
 options("logr.notes" = FALSE,
         "logr.autolog" = TRUE)
@@ -172,10 +171,10 @@ 

Program# Get sample data path pth <- system.file("extdata", package = "sassy") - +put("Open data library") libname(sdtm, pth, "csv") - +put("Load data into environment") lib_load(sdtm) @@ -192,7 +191,7 @@

Program RACE = "Race", BRTHDTC = "Birth Date", ARMCD = "Treatment Code" - ) |> put() +) |> put() put("AE labels") labels(sdtm.AE) <- list(AESTDTC = "Event Start Date", AEENDTC = "Event Stop Date", @@ -234,7 +233,7 @@

Program condition(x == "ARM B", "Dose 50mg"), condition(x == "ARM C", "Dose 100mg"), condition(x == "ARM D", "Competitor")) - + formats(sdtm.DM) <- list(SEX = sexfmt, RACE = racefmt, @@ -249,16 +248,18 @@

Program sep("Prepare data") -dm <- sdtm.DM |> - select(USUBJID, ARM, SITEID, SUBJID, SEX, AGE, RACE, BRTHDTC) |> put() +put("Select desired columns from DM dataset") +datastep(sdtm.DM, + keep = v(USUBJID, ARM, SITEID, SUBJID, SEX, AGE, RACE, BRTHDTC), {}) -> dm + # Split dm data by subject id dmlst <- split(dm, factor(dm$USUBJID)) - -ae <- sdtm.AE |> - select(USUBJID, AESTDTC, AEENDTC, AESTDY, - AEENDY, AESOC, AESEV, AESER, AEREL) |> put() +put("Select desired columns from AE dataset") +datastep(sdtm.AE, + keep = v(USUBJID, AESTDTC, AEENDTC, AESTDY, + AEENDY, AESOC, AESEV, AESER, AEREL), {}) -> ae # Split ae data by subject id aelst <- split(ae, factor(ae$USUBJID)) @@ -295,11 +296,11 @@

Program "06=Investigational product discontinued, 07=Transfusion performed,", "88=Other")) } - + # Append table content rpt <- rpt |> add_content(tb1, page_break = FALSE) |> - add_content(tb2) - + add_content(tb2) + } put("Write out report") @@ -333,38 +334,35 @@

Log

Here is most of the log from the above program:

=========================================================================
-Log Path: C:/Users/dbosa/AppData/Local/Temp/Rtmp8cFaMB/log/example8.log
-Program Path: C:/packages/Testing/Example8.R
-Working Directory: C:/packages/Testing
+Log Path: C:/Users/dbosa/AppData/Local/Temp/Rtmp6lCP5X/log/example8.log
+Program Path: C:/packages/Testing/procs/ProcsPatientProfile.R
+Working Directory: C:/packages/Testing/procs
 User Name: dbosa
-R Version: 4.2.0 (2022-04-22 ucrt)
+R Version: 4.3.1 (2023-06-16 ucrt)
 Machine: SOCRATES x86-64
-Operating System: Windows 10 x64 build 19044
-Base Packages: stats graphics grDevices utils datasets methods base
-Other Packages: tidylog_1.0.2 magrittr_2.0.3 reporter_1.3.3 libr_1.2.3 fmtr_1.5.8
-                common_1.0.1 logr_1.3.1 sassy_1.0.7 forcats_0.5.1 stringr_1.4.0
-                dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.7
-                ggplot2_3.3.6 tidyverse_1.3.1 cranlogs_2.1.1 
-Log Start Time: 2022-07-21 22:31:09
+Operating System: Windows 10 x64 build 22621
+Base Packages: stats graphics grDevices utils datasets methods base Other
+Packages: tidylog_1.0.2 ggplot2_3.4.2 patchwork_1.1.3 procs_1.0.3
+reporter_1.4.1 libr_1.2.8 fmtr_1.5.9 logr_1.3.4 common_1.0.8 sassy_1.2.0
+Log Start Time: 2023-09-06 21:24:18.59308
 =========================================================================
 
 =========================================================================
 Get data
 =========================================================================
 
-# library 'sdtm': 8 items
+# library 'sdtm': 7 items
 - attributes: csv not loaded
-- path: C:/Users/dbosa/AppData/Local/R/win-library/4.2/reporter/extdata
+- path: C:/Users/dbosa/AppData/Local/R/win-library/4.3/sassy/extdata
 - items:
   Name Extension Rows Cols     Size        LastModified
-1   AE       csv  150   27  88.5 Kb 2022-07-10 08:49:03
-2   DA       csv 3587   18 528.2 Kb 2022-07-10 08:49:03
-3   DM       csv   87   24  45.5 Kb 2022-07-10 08:49:03
-4   DS       csv  174    9  34.1 Kb 2022-07-10 08:49:03
-5   EX       csv   84   11  26.4 Kb 2022-07-10 08:49:03
-6   IE       csv    2   14  13.4 Kb 2022-07-10 08:49:03
-7   SV       csv  685   10  70.3 Kb 2022-07-10 08:49:03
-8   VS       csv 3358   17 467.4 Kb 2022-07-10 08:49:03
+1   AE       csv  150   27  88.5 Kb 2023-09-06 21:14:37
+2   DM       csv   87   24  45.5 Kb 2023-09-06 21:14:37
+3   DS       csv  174    9  34.1 Kb 2023-09-06 21:14:37
+4   EX       csv   84   11  26.4 Kb 2023-09-06 21:14:37
+5   IE       csv    2   14  13.4 Kb 2023-09-06 21:14:37
+6   SV       csv  685   10  70.3 Kb 2023-09-06 21:14:37
+7   VS       csv 3358   17 467.4 Kb 2023-09-06 21:14:37
 
 lib_load: library 'sdtm' loaded
 
@@ -472,7 +470,9 @@ 

Log Prepare data ========================================================================= -select: dropped 16 variables (STUDYID, DOMAIN, RFSTDTC, RFENDTC, RFXSTDTC, …) +Select desired columns from DM dataset + +datastep: columns decreased from 24 to 8 # A tibble: 87 × 8 USUBJID ARM SITEID SUBJID SEX AGE RACE BRTHDTC @@ -487,24 +487,28 @@

Log 8 ABC-01-056 ARM A 01 056 M 31 WHITE 1975-05-02 9 ABC-01-113 ARM D 01 113 M 74 WHITE 1932-02-08 10 ABC-01-114 ARM B 01 114 F 72 WHITE 1934-07-09 -# … with 77 more rows +# ℹ 77 more rows +# ℹ Use `print(n = ...)` to see more rows + +Select desired columns from AE dataset -select: dropped 18 variables (STUDYID, DOMAIN, AESEQ, AETERM, AELLT, …) +datastep: columns decreased from 27 to 9 # A tibble: 150 × 9 - USUBJID AESTDTC AEENDTC AESTDY AEENDY AESOC AESEV AESER AEREL - <chr> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr> <chr> - 1 ABC-01-049 2006-12-28 2007-03-13 52 127 Investigations MODERATE N NOT RELATED - 2 ABC-01-049 2006-12-28 2007-03-13 52 127 Investigations MODERATE N NOT RELATED - 3 ABC-01-049 2007 2007 NA NA Nervous system disorders MILD N NOT RELATED - 4 ABC-01-049 2007-01-11 2007-03-13 66 127 Investigations MODERATE N NOT RELATED - 5 ABC-01-049 2007 2007 NA NA Musculoskeletal and connective tissue disorders MILD N NOT RELATED - 6 ABC-01-050 2006-11-08 2006-11-15 7 14 Skin and subcutaneous tissue disorders MILD N NOT RELATED - 7 ABC-01-050 2006-12-17 2006-12-17 46 46 Respiratory, thoracic and mediastinal disorders MILD N NOT RELATED - 8 ABC-01-051 2007-01-01 2007-01-01 61 61 Nervous system disorders MILD N NOT RELATED - 9 ABC-01-051 2007-03-06 2007-03-09 125 128 Nervous system disorders MILD N NOT RELATED -10 ABC-01-051 2007-11-12 2007-11-14 376 378 Nervous system disorders MILD N NOT RELATED -# … with 140 more rows + USUBJID AESTDTC AEENDTC AESTDY AEENDY AESOC AESEV AESER AEREL + <chr> <chr> <chr> <dbl> <dbl> <chr> <chr> <chr> <chr> + 1 ABC-01-049 2006-12-28 2007-03-13 52 127 Investigations MODE… N NOT … + 2 ABC-01-049 2006-12-28 2007-03-13 52 127 Investigations MODE… N NOT … + 3 ABC-01-049 2007 2007 NA NA Nervous system diso… MILD N NOT … + 4 ABC-01-049 2007-01-11 2007-03-13 66 127 Investigations MODE… N NOT … + 5 ABC-01-049 2007 2007 NA NA Musculoskeletal and… MILD N NOT … + 6 ABC-01-050 2006-11-08 2006-11-15 7 14 Skin and subcutaneo… MILD N NOT … + 7 ABC-01-050 2006-12-17 2006-12-17 46 46 Respiratory, thorac… MILD N NOT … + 8 ABC-01-051 2007-01-01 2007-01-01 61 61 Nervous system diso… MILD N NOT … + 9 ABC-01-051 2007-03-06 2007-03-09 125 128 Nervous system diso… MILD N NOT … +10 ABC-01-051 2007-11-12 2007-11-14 376 378 Nervous system diso… MILD N NOT … +# ℹ 140 more rows +# ℹ Use `print(n = ...)` to see more rows ========================================================================= Create report @@ -513,7 +517,7 @@

Log Write out report # A report specification: 87 pages -- file_path: 'C:\Users\dbosa\AppData\Local\Temp\Rtmp8cFaMB/output/example6.docx' +- file_path: 'C:\Users\dbosa\AppData\Local\Temp\Rtmp6lCP5X/output/example8.docx' - output_type: DOCX - units: inches - orientation: landscape @@ -540,50 +544,8 @@

Log - define: AESOC width=2 - define: AESTDY align='left' - define: AEENDY align='left' -# A table specification: -- data: tibble 'dm_sub' 1 rows 8 cols -- show_cols: all -- use_attributes: all -- width: 8 -- title 1: 'Listing 1.1 Subjects Narratives of Adverse Events' -- title 2: 'Subject: ABC-01-050' -- define: AGE align='left' -# A table specification: -- data: tibble 'ae_sub' 2 rows 9 cols -- show_cols: all -- use_attributes: all -- width: 8 -- footnote 1: 'ᵃSeverity: 01=Mild, 02=Moderate, 03=Severe, 04=Life Threatening, 05=Fatal' -- footnote 2: 'ᵇAction Taken: 01=None, 02=Investigational product dose altered, 03=Medication taken, 04=Hospitalized, 05=Removed from study, 06=Investigational product discontinued, 07=Transfusion performed,88=Other' -- spanning_header: from='AESTDY' to='AEENDY' 'Study Day' level=1 -- define: USUBJID visible='FALSE' -- define: AESOC width=2 -- define: AESTDY align='left' -- define: AEENDY align='left' - ... -# A table specification: -- data: tibble 'dm_sub' 1 rows 8 cols -- show_cols: all -- use_attributes: all -- width: 8 -- title 1: 'Listing 1.1 Subjects Narratives of Adverse Events' -- title 2: 'Subject: ABC-09-140' -- define: AGE align='left' -# A table specification: -- data: tibble 'ae_sub' 2 rows 9 cols -- show_cols: all -- use_attributes: all -- width: 8 -- footnote 1: 'ᵃSeverity: 01=Mild, 02=Moderate, 03=Severe, 04=Life Threatening, 05=Fatal' -- footnote 2: 'ᵇAction Taken: 01=None, 02=Investigational product dose altered, 03=Medication taken, 04=Hospitalized, 05=Removed from study, 06=Investigational product discontinued, 07=Transfusion performed,88=Other' -- spanning_header: from='AESTDY' to='AEENDY' 'Study Day' level=1 -- define: USUBJID visible='FALSE' -- define: AESOC width=2 -- define: AESTDY align='left' -- define: AEENDY align='left' - ========================================================================= Clean up ========================================================================= @@ -593,8 +555,8 @@

Log lib_unload: library 'sdtm' unloaded ========================================================================= -Log End Time: 2022-07-21 22:31:15 -Log Elapsed Time: 0 00:00:05 +Log End Time: 2023-09-06 21:24:25.764916 +Log Elapsed Time: 0 00:00:07 =========================================================================

Next: Example 9: Forest Plot

diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index d09cbca..1d2eea0 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -17,7 +17,7 @@ articles: sassy-survival: sassy-survival.html sassy-vs: sassy-vs.html sassy: sassy.html -last_built: 2023-09-07T00:33Z +last_built: 2023-09-07T01:39Z urls: reference: https://sassy.r-sassy.org/reference article: https://sassy.r-sassy.org/articles diff --git a/vignettes/sassy-ae.Rmd b/vignettes/sassy-ae.Rmd index f56a268..a5a214d 100644 --- a/vignettes/sassy-ae.Rmd +++ b/vignettes/sassy-ae.Rmd @@ -34,7 +34,6 @@ Note the following about this example: ```{r eval=FALSE, echo=TRUE} library(sassy) -library(procs) options("logr.autolog" = TRUE, "logr.notes" = FALSE, diff --git a/vignettes/sassy-dm.Rmd b/vignettes/sassy-dm.Rmd index caea7d6..4f0eb2c 100644 --- a/vignettes/sassy-dm.Rmd +++ b/vignettes/sassy-dm.Rmd @@ -36,7 +36,6 @@ Note the following about this example: ```{r eval=FALSE, echo=TRUE} library(sassy) -library(procs) # Prepare Log ------------------------------------------------------------- diff --git a/vignettes/sassy-ds.Rmd b/vignettes/sassy-ds.Rmd index 8b43d87..08ee7a1 100644 --- a/vignettes/sassy-ds.Rmd +++ b/vignettes/sassy-ds.Rmd @@ -21,7 +21,6 @@ The example also shows how to create a stub column with summary rows. ```{r eval=FALSE, echo=TRUE} library(sassy) -library(procs) library(stringr) options("logr.autolog" = TRUE, diff --git a/vignettes/sassy-figure.Rmd b/vignettes/sassy-figure.Rmd index 72ace9b..d66b773 100644 --- a/vignettes/sassy-figure.Rmd +++ b/vignettes/sassy-figure.Rmd @@ -32,7 +32,6 @@ just like previous examples. ```{r eval=FALSE, echo=TRUE} library(ggplot2) library(sassy) -library(procs) # Prepare Log ------------------------------------------------------------- diff --git a/vignettes/sassy-figureby.Rmd b/vignettes/sassy-figureby.Rmd index dd4a0f1..32b2e3d 100644 --- a/vignettes/sassy-figureby.Rmd +++ b/vignettes/sassy-figureby.Rmd @@ -30,7 +30,6 @@ paging for both the report and plot. ```{r eval=FALSE, echo=TRUE} library(ggplot2) library(sassy) -library(procs) options("logr.autolog" = TRUE, "logr.notes" = FALSE) diff --git a/vignettes/sassy-pfigure.Rmd b/vignettes/sassy-pfigure.Rmd index a1ae8fa..129fad3 100644 --- a/vignettes/sassy-pfigure.Rmd +++ b/vignettes/sassy-pfigure.Rmd @@ -27,8 +27,8 @@ Note the following about this example: patchwork images into any output type that accepts images. ```{r eval=FALSE, echo=TRUE} -library(tidyverse) library(sassy) +library(ggplot2) library(patchwork) @@ -52,39 +52,35 @@ lgpth <- log_open(file.path(tmp, "example12.log")) sep("Prepare Data") -# Define data library +put("Define data library") libname(sdtm, dir, "csv") -# Loads data into workspace +put("Load data into workspace") lib_load(sdtm) -# Prepare data -dm_mod <- sdtm.DM %>% - select(USUBJID, SEX, AGE, ARM) %>% - filter(ARM != "SCREEN FAILURE") %>% - datastep({ - - if (AGE >= 18 & AGE <= 24) - AGECAT = "18 to 24" - else if (AGE >= 25 & AGE <= 44) - AGECAT = "25 to 44" - else if (AGE >= 45 & AGE <= 64) - AGECAT <- "45 to 64" - else if (AGE >= 65) - AGECAT <- ">= 65" - - }) %>% put() +put("Prepare format") +agefmt <- value(condition(x >= 18 & x <= 24, "18 to 24"), + condition(x >= 25 & x <= 44, "25 to 44"), + condition(x >= 45 & x <= 64, "45 to 64"), + condition(x >= 65, ">= 65")) + +put("Prepare data") +datastep(sdtm.DM, + keep = v(USUBJID, SEX, AGE, ARM, AGECAT), + where = expression(ARM != "SCREEN FAILURE"), + { + + AGECAT = fapply(AGE, agefmt) + + }) -> dm_mod put("Convert agecat to factor it will sort correctly") -dm_mod$AGECAT <- factor(dm_mod$AGECAT, levels = c("18 to 24", - "25 to 44", - "45 to 64", - ">= 65")) +dm_mod$AGECAT <- factor(dm_mod$AGECAT, levels = levels(agefmt)) put("Split by ARM") dm_sub <- split(dm_mod, factor(dm_mod$ARM)) - + # Create Plots ------------------------------------------------------------ @@ -124,16 +120,16 @@ sep("Create and print report") pth <- file.path(tmp, "output/example12.rtf") -plt <- create_plot(plts, 4.5, 7) %>% +plt <- create_plot(plts, 4.5, 7) |> titles("Figure 3.2", "Distribution of Subjects by Treatment Group", font_size = 11, bold = TRUE) -rpt <- create_report(pth, output_type = "RTF", font = "Arial") %>% - set_margins(top = 1, bottom = 1) %>% - page_header("Sponsor: Company", "Study: ABC") %>% - add_content(plt) %>% - footnotes("Program: DM_Figure.R") %>% +rpt <- create_report(pth, output_type = "RTF", font = "Arial") |> + set_margins(top = 1, bottom = 1) |> + page_header("Sponsor: Company", "Study: ABC") |> + add_content(plt) |> + footnotes("Program: DM_Figure.R") |> page_footer(paste0("Date Produced: ", fapply(Sys.time(), "%d%b%y %H:%M")), right = "Page [pg] of [tpg]") @@ -167,36 +163,70 @@ Here is the log produced by the above combined plot example: ``` ========================================================================= -Log Path: C:/Users/dbosa/AppData/Local/Temp/RtmpqsSwWj/log/example12.log -Program Path: C:/packages/sassy/vignettes/sassy-pfigure.Rmd -Working Directory: C:/packages/sassy/vignettes +Log Path: C:/Users/dbosa/AppData/Local/Temp/RtmpkNnsUE/log/example12.log +Program Path: C:/packages/Testing/procs/ProcsCombinedFigure.R +Working Directory: C:/packages/Testing/procs User Name: dbosa -R Version: 4.2.1 (2022-06-23 ucrt) +R Version: 4.3.1 (2023-06-16 ucrt) Machine: SOCRATES x86-64 -Operating System: Windows 10 x64 build 19044 +Operating System: Windows 10 x64 build 22621 Base Packages: stats graphics grDevices utils datasets methods base Other -Packages: tidylog_1.0.2 patchwork_1.1.2 reporter_1.3.8 libr_1.2.8 fmtr_1.5.9 -logr_1.3.3 common_1.0.5 sassy_1.0.8 forcats_0.5.2 stringr_1.4.1 dplyr_1.0.10 -purrr_0.3.5 readr_2.1.3 tidyr_1.2.1 tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.2 -Log Start Time: 2022-11-28 17:11:15 +Packages: tidylog_1.0.2 ggplot2_3.4.2 patchwork_1.1.3 procs_1.0.3 +reporter_1.4.1 libr_1.2.8 fmtr_1.5.9 logr_1.3.4 common_1.0.8 sassy_1.1.0 +Log Start Time: 2023-09-06 21:06:40.53712 ========================================================================= ========================================================================= Prepare Data ========================================================================= -# library 'sdtm': 8 items +Define data library + +# library 'sdtm': 7 items - attributes: csv not loaded -- path: C:/Users/dbosa/AppData/Local/R/win-library/4.2/sassy/extdata +- path: C:/Users/dbosa/AppData/Local/R/win-library/4.3/sassy/extdata - items: + Name Extension Rows Cols Size LastModified +1 AE csv 150 27 88.5 Kb 2023-08-07 17:51:40 +2 DM csv 87 24 45.5 Kb 2023-08-07 17:51:40 +3 DS csv 174 9 34.1 Kb 2023-08-07 17:51:40 +4 EX csv 84 11 26.4 Kb 2023-08-07 17:51:40 +5 IE csv 2 14 13.4 Kb 2023-08-07 17:51:40 +6 SV csv 685 10 70.3 Kb 2023-08-07 17:51:40 +7 VS csv 3358 17 467.4 Kb 2023-08-07 17:51:40 -lib_load: library 'sdtm' loaded - -select: dropped 20 variables (STUDYID, DOMAIN, SUBJID, RFSTDTC, RFENDTC, …) +Load data into workspace -filter: removed 2 rows (2%), 85 rows remaining +lib_load: library 'sdtm' loaded -datastep: columns increased from 4 to 5 +Prepare format + +# A user-defined format: 4 conditions + Name Type Expression Label Order +1 obj U x >= 18 & x <= 24 18 to 24 NA +2 obj U x >= 25 & x <= 44 25 to 44 NA +3 obj U x >= 45 & x <= 64 45 to 64 NA +4 obj U x >= 65 >= 65 NA + +Prepare data + +datastep: columns decreased from 24 to 5 + +# A tibble: 85 × 5 + USUBJID SEX AGE ARM AGECAT + + 1 ABC-01-049 M 39 ARM D 25 to 44 + 2 ABC-01-050 M 47 ARM B 45 to 64 + 3 ABC-01-051 M 34 ARM A 25 to 44 + 4 ABC-01-052 F 45 ARM C 45 to 64 + 5 ABC-01-053 F 26 ARM B 25 to 44 + 6 ABC-01-054 M 44 ARM D 25 to 44 + 7 ABC-01-055 F 47 ARM C 45 to 64 + 8 ABC-01-056 M 31 ARM A 25 to 44 + 9 ABC-01-113 M 74 ARM D >= 65 +10 ABC-01-114 F 72 ARM B >= 65 +# ℹ 75 more rows +# ℹ Use `print(n = ...)` to see more rows Convert agecat to factor it will sort correctly @@ -221,24 +251,7 @@ Create and print report ========================================================================= # A report specification: 1 pages -- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpqsSwWj/output/example12.rtf' -- output_type: RTF -- units: inches -- orientation: landscape -- margins: top 1 bottom 1 left 1 right 1 -- line size/count: 9/36 -- page_header: left=Sponsor: Company right=Study: ABC -- footnote 1: 'Program: DM_Figure.R' -- page_footer: left=Date Produced: 28Nov22 17:11 center= right=Page [pg] of [tpg] -- content: -# A plot specification: -- height: 4.5 -- width: 7 -- title 1: 'Figure 3.2' -- title 2: 'Distribution of Subjects by Treatment Group' - -# A report specification: 1 pages -- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpqsSwWj/output/example12.rtf' +- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpkNnsUE/output/example12.rtf' - output_type: RTF - units: inches - orientation: landscape @@ -246,7 +259,7 @@ Create and print report - line size/count: 9/36 - page_header: left=Sponsor: Company right=Study: ABC - footnote 1: 'Program: DM_Figure.R' -- page_footer: left=Date Produced: 28Nov22 17:11 center= right=Page [pg] of [tpg] +- page_footer: left=Date Produced: 06Sep23 21:06 center= right=Page [pg] of [tpg] - content: # A plot specification: - height: 4.5 @@ -258,11 +271,9 @@ lib_sync: synchronized data in library 'sdtm' lib_unload: library 'sdtm' unloaded -lib_unload: library 'sdtm' unloaded - ========================================================================= -Log End Time: 2022-11-28 17:11:43 -Log Elapsed Time: 0 00:00:27 +Log End Time: 2023-09-06 21:06:43.938549 +Log Elapsed Time: 0 00:00:03 ========================================================================= diff --git a/vignettes/sassy-plisting.Rmd b/vignettes/sassy-plisting.Rmd index eed84ae..95a089c 100644 --- a/vignettes/sassy-plisting.Rmd +++ b/vignettes/sassy-plisting.Rmd @@ -32,8 +32,8 @@ Note the following about this example: * The program produces both RTF and PDF outputs from the same report object. ```{r eval=FALSE, echo=TRUE} -library(tidyverse) library(sassy) +library(procs) # Prepare Log ------------------------------------------------------------- @@ -107,12 +107,9 @@ datastep(sdtm.VS, }) -> vso put("Pivot vitals signs") -vsot <- vso |> - group_by(USUBJID, VISITNUM, VISIT) |> - pivot_wider(names_from = VSTESTCD, - values_from = VSCOMB) |> - ungroup() |> - arrange(USUBJID, VISITNUM) |> put() +proc_transpose(vso, id = VSTESTCD, var = VSCOMB, + by = v(USUBJID, VISITNUM, VISIT)) |> + proc_sort(by = v(USUBJID, VISITNUM)) -> vsot put("Assign and apply formats") @@ -231,252 +228,117 @@ Here is the log produced by the above subject listing: ``` ========================================================================= -Log Path: C:/Users/dbosa/AppData/Local/Temp/RtmpeYEHwE/log/example11.log -Program Path: C:/packages/Testing/example11.R -Working Directory: C:/packages/Testing +Log Path: C:/Users/dbosa/AppData/Local/Temp/RtmpkNnsUE/log/example12.log +Program Path: C:/packages/Testing/procs/ProcsCombinedFigure.R +Working Directory: C:/packages/Testing/procs User Name: dbosa -R Version: 4.2.1 (2022-06-23 ucrt) +R Version: 4.3.1 (2023-06-16 ucrt) Machine: SOCRATES x86-64 -Operating System: Windows 10 x64 build 19044 +Operating System: Windows 10 x64 build 22621 Base Packages: stats graphics grDevices utils datasets methods base Other -Packages: tidylog_1.0.2 reporter_1.3.7 libr_1.2.6 fmtr_1.5.9 logr_1.3.3 -sassy_1.0.8 forcats_0.5.2 stringr_1.4.0 dplyr_1.0.10 purrr_0.3.4 readr_2.1.2 -tidyr_1.2.0 tibble_3.1.8 ggplot2_3.3.6 tidyverse_1.3.1 cranlogs_2.1.1 -common_1.0.5 -Log Start Time: 2022-10-09 19:18:43 +Packages: tidylog_1.0.2 ggplot2_3.4.2 patchwork_1.1.3 procs_1.0.3 +reporter_1.4.1 libr_1.2.8 fmtr_1.5.9 logr_1.3.4 common_1.0.8 sassy_1.1.0 +Log Start Time: 2023-09-06 21:06:40.53712 ========================================================================= -========================================================================= -Prepare formats -========================================================================= - -# A user-defined format: 4 conditions - Name Type Expression Label Order -1 obj U x == "WHITE" White NA -2 obj U x == "BLACK OR AFRICAN AMERICAN" Black or African American NA -3 obj U x == "ASIAN OR PACIFIC ISLANDER" Asian or Pacific Islander NA -4 obj U TRUE Other NA - -# A user-defined format: 3 conditions - Name Type Expression Label Order -1 obj U x == "NOT HISPANIC OR LATINO" Not Hispanic or Latino NA -2 obj U x == "HISPANIC OR LATINO" Hispanic or Latino NA -3 obj U TRUE Unknown NA - -# A user-defined format: 5 conditions - Name Type Expression Label Order -1 obj U x == "ARM A" Placebo NA -2 obj U x == "ARM B" Drug 50mg NA -3 obj U x == "ARM C" Drug 100mg NA -4 obj U x == "ARM D" Competitor NA -5 obj U TRUE Not Treated/Screen Failure NA - -# A user-defined format: 4 conditions - Name Type Expression Label Order -1 obj U x == "BEATS/MIN" bpm NA -2 obj U x == "BREATHS/MIN" brths/min NA -3 obj U x == "C" °C NA -4 obj U x == "mmHg" NA - -# A user-defined format: 8 conditions - Name Type Expression Label Order -1 obj U x == "DAY 1" Day 1 NA -2 obj U x == "WEEK 2" Week 2 NA -3 obj U x == "WEEK 4" Week 4 NA -4 obj U x == "WEEK 6" Week 6 NA -5 obj U x == "WEEK 8" Week 8 NA -6 obj U x == "WEEK 12" Week 12 NA -7 obj U x == "WEEK 16" Week 16 NA -8 obj U TRUE Early Termination NA - -# A format catalog: 10 formats -- $SEX: type V, 2 elements -- $AGE: type S, "%d Years" -- $RACE: type U, 4 conditions -- $WEIGHT: type S, "%6.2f kg" -- $EAR: type V, 2 elements -- $DOSE: type S, "%4.2fug" -- $ETHNIC: type U, 3 conditions -- $ARMT: type U, 5 conditions -- $UNITS: type U, 4 conditions -- $VISIT: type U, 8 conditions - ========================================================================= Prepare Data ========================================================================= -# library 'sdtm': 8 items +Define data library + +# library 'sdtm': 7 items - attributes: csv not loaded -- path: C:/Users/dbosa/AppData/Local/R/win-library/4.2/sassy/extdata +- path: C:/Users/dbosa/AppData/Local/R/win-library/4.3/sassy/extdata - items: Name Extension Rows Cols Size LastModified -1 AE csv 150 27 88.5 Kb 2022-09-05 10:57:47 -2 DA csv 3587 18 528.2 Kb 2022-09-05 10:57:47 -3 DM csv 87 24 45.5 Kb 2022-09-05 10:57:47 -4 DS csv 174 9 34.1 Kb 2022-09-05 10:57:47 -5 EX csv 84 11 26.4 Kb 2022-09-05 10:57:47 -6 IE csv 2 14 13.4 Kb 2022-09-05 10:57:47 -7 SV csv 685 10 70.3 Kb 2022-09-05 10:57:47 -8 VS csv 3358 17 467.4 Kb 2022-09-05 10:57:47 +1 AE csv 150 27 88.5 Kb 2023-08-07 17:51:40 +2 DM csv 87 24 45.5 Kb 2023-08-07 17:51:40 +3 DS csv 174 9 34.1 Kb 2023-08-07 17:51:40 +4 EX csv 84 11 26.4 Kb 2023-08-07 17:51:40 +5 IE csv 2 14 13.4 Kb 2023-08-07 17:51:40 +6 SV csv 685 10 70.3 Kb 2023-08-07 17:51:40 +7 VS csv 3358 17 467.4 Kb 2023-08-07 17:51:40 + +Load data into workspace lib_load: library 'sdtm' loaded -Format desired vital signs - -datastep: columns decreased from 17 to 5 - -# A tibble: 2,764 × 5 - USUBJID VSTESTCD VSCOMB VISITNUM VISIT - - 1 ABC-01-049 DIABP "76 " 1 DAY 1 - 2 ABC-01-049 DIABP "66 " 2 WEEK 2 - 3 ABC-01-049 DIABP "84 " 4 WEEK 4 - 4 ABC-01-049 DIABP "68 " 6 WEEK 6 - 5 ABC-01-049 DIABP "80 " 8 WEEK 8 - 6 ABC-01-049 DIABP "70 " 12 WEEK 12 - 7 ABC-01-049 DIABP "70 " 16 WEEK 16 - 8 ABC-01-049 PULSE "84 bpm" 1 DAY 1 - 9 ABC-01-049 PULSE "84 bpm" 2 WEEK 2 -10 ABC-01-049 PULSE "76 bpm" 4 WEEK 4 -# … with 2,754 more rows +Prepare format + +# A user-defined format: 4 conditions + Name Type Expression Label Order +1 obj U x >= 18 & x <= 24 18 to 24 NA +2 obj U x >= 25 & x <= 44 25 to 44 NA +3 obj U x >= 45 & x <= 64 45 to 64 NA +4 obj U x >= 65 >= 65 NA + +Prepare data + +datastep: columns decreased from 24 to 5 + +# A tibble: 85 × 5 + USUBJID SEX AGE ARM AGECAT + + 1 ABC-01-049 M 39 ARM D 25 to 44 + 2 ABC-01-050 M 47 ARM B 45 to 64 + 3 ABC-01-051 M 34 ARM A 25 to 44 + 4 ABC-01-052 F 45 ARM C 45 to 64 + 5 ABC-01-053 F 26 ARM B 25 to 44 + 6 ABC-01-054 M 44 ARM D 25 to 44 + 7 ABC-01-055 F 47 ARM C 45 to 64 + 8 ABC-01-056 M 31 ARM A 25 to 44 + 9 ABC-01-113 M 74 ARM D >= 65 +10 ABC-01-114 F 72 ARM B >= 65 +# ℹ 75 more rows # ℹ Use `print(n = ...)` to see more rows -Pivot vitals signs +Convert agecat to factor it will sort correctly -group_by: 3 grouping variables (USUBJID, VISITNUM, VISIT) +Split by ARM -pivot_wider: reorganized (VSTESTCD, VSCOMB) into (DIABP, PULSE, RESP, SYSBP, TEMP) [was 2764x5, now 554x8] +========================================================================= +Create Plots +========================================================================= -ungroup: no grouping variables +Create plot for ARM A -# A tibble: 554 × 8 - USUBJID VISITNUM VISIT DIABP PULSE RESP SYSBP TEMP - - 1 ABC-01-049 1 DAY 1 "76 " 84 bpm 20 brths/min "120 " 36.4°C - 2 ABC-01-049 2 WEEK 2 "66 " 84 bpm 16 brths/min "128 " 36.6°C - 3 ABC-01-049 4 WEEK 4 "84 " 76 bpm 16 brths/min "134 " 35.7°C - 4 ABC-01-049 6 WEEK 6 "68 " 64 bpm 20 brths/min "100 " 36.5°C - 5 ABC-01-049 8 WEEK 8 "80 " 84 bpm 16 brths/min "128 " 36.4°C - 6 ABC-01-049 12 WEEK 12 "70 " 60 bpm 20 brths/min "120 " 36.6°C - 7 ABC-01-049 16 WEEK 16 "70 " 72 bpm 18 brths/min "130 " 36.2°C - 8 ABC-01-050 1 DAY 1 "78 " 68 bpm 18 brths/min "100 " 36.7°C - 9 ABC-01-050 2 WEEK 2 "64 " 68 bpm 18 brths/min "110 " 36.7°C -10 ABC-01-050 4 WEEK 4 "86 " 82 bpm 16 brths/min "128 " 36.6°C -# … with 544 more rows -# ℹ Use `print(n = ...)` to see more rows +Create plot for ARM B + +Create plot for ARM C -Assign and apply formats - -# A tibble: 87 × 24 - STUDYID DOMAIN USUBJID SUBJID RFSTDTC RFENDTC RFXSTDTC RFXENDTC RFICDTC RFPENDTC DTHDTC DTHFL SITEID - - 1 ABC DM ABC-01-049 049 2006-11-07 NA NA NA 2006-10-25 NA NA NA 01 - 2 ABC DM ABC-01-050 050 2006-11-02 NA NA NA 2006-10-25 NA NA NA 01 - 3 ABC DM ABC-01-051 051 2006-11-02 NA NA NA 2006-10-25 NA NA NA 01 - 4 ABC DM ABC-01-052 052 2006-11-06 NA NA NA 2006-10-31 NA NA NA 01 - 5 ABC DM ABC-01-053 053 2006-11-08 NA NA NA 2006-11-01 NA NA NA 01 - 6 ABC DM ABC-01-054 054 2006-11-16 NA NA NA 2006-11-07 NA NA NA 01 - 7 ABC DM ABC-01-055 055 2006-12-06 NA NA NA 2006-10-31 NA NA NA 01 - 8 ABC DM ABC-01-056 056 2006-11-28 NA NA NA 2006-11-21 NA NA NA 01 - 9 ABC DM ABC-01-113 113 2006-12-05 NA NA NA 2006-11-28 NA NA NA 01 -10 ABC DM ABC-01-114 114 2006-12-14 NA NA NA 2006-12-01 NA NA NA 01 -# … with 77 more rows, and 11 more variables: BRTHDTC , AGE , AGEU , SEX , RACE , -# ETHNIC , ARMCD , ARM , ACTARMCD , ACTARM , COUNTRY -# ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names - -Prepare final data for reporting - -datastep: columns increased from 24 to 36 - -# A tibble: 554 × 36 - STUDYID DOMAIN USUBJID SUBJID RFSTDTC RFENDTC RFXSTDTC RFXENDTC RFICDTC RFPENDTC DTHDTC DTHFL SITEID - - 1 ABC DM ABC-01-049 049 2006-11-07 NA NA NA 2006-10-25 NA NA NA 01 - 2 ABC DM ABC-01-049 049 2006-11-07 NA NA NA 2006-10-25 NA NA NA 01 - 3 ABC DM ABC-01-049 049 2006-11-07 NA NA NA 2006-10-25 NA NA NA 01 - 4 ABC DM ABC-01-049 049 2006-11-07 NA NA NA 2006-10-25 NA NA NA 01 - 5 ABC DM ABC-01-049 049 2006-11-07 NA NA NA 2006-10-25 NA NA NA 01 - 6 ABC DM ABC-01-049 049 2006-11-07 NA NA NA 2006-10-25 NA NA NA 01 - 7 ABC DM ABC-01-049 049 2006-11-07 NA NA NA 2006-10-25 NA NA NA 01 - 8 ABC DM ABC-01-050 050 2006-11-02 NA NA NA 2006-10-25 NA NA NA 01 - 9 ABC DM ABC-01-050 050 2006-11-02 NA NA NA 2006-10-25 NA NA NA 01 -10 ABC DM ABC-01-050 050 2006-11-02 NA NA NA 2006-10-25 NA NA NA 01 -# … with 544 more rows, and 23 more variables: BRTHDTC , AGE , AGEU , SEX , RACE , -# ETHNIC , ARMCD , ARM , ACTARMCD , ACTARM , COUNTRY , VISITNUM , VISIT , -# DIABP , PULSE , RESP , SYSBP , TEMP , BASELINE , BP , TREATMENT , PG , -# PTCNT -# ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names +Create plot for ARM D + +Combine 4 plots into 1 using patchwork ========================================================================= -Create and Print Report +Create and print report ========================================================================= -# A report specification: 29 pages -- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpeYEHwE/example11.rtf' +# A report specification: 1 pages +- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpkNnsUE/output/example12.rtf' - output_type: RTF - units: inches - orientation: landscape - margins: top 1 bottom 1 left 1 right 1 -- line size/count: 9/37 -- page_header: left=Program:C:/packages/Testing/example11.R right=Draft -- page_footer: left=Date: 09OCT2022 19:18:50 center=Archytas right=Page [pg] of [tpg] -- content: -# A table specification: -- data: tibble 'final' 554 rows 36 cols -- show_cols: none -- use_attributes: all -- width: 9 -- stub: BASELINE TREATMENT 'Subject/Treatment' align='left' -- define: BASELINE dedupe='TRUE' -- define: TREATMENT -- define: VISIT 'Visit' -- define: TEMP 'Temperature' -- define: PULSE 'Pulse' -- define: RESP 'Respirations' -- define: BP 'Blood Pressure' -- define: USUBJID visible='FALSE' -- define: PG visible='FALSE' page_break='TRUE' - -# A report specification: 29 pages -- file_path: 'C:\Users\dbosa\AppData\Local\Temp\RtmpeYEHwE/example11.pdf' -- output_type: PDF -- units: inches -- orientation: landscape -- margins: top 1 bottom 1 left 1 right 1 -- line size/count: 9/42 -- page_header: left=Program:C:/packages/Testing/example11.R right=Draft -- title 1: 'Study: ABC' -- title 2: 'Appendix 10.2.6.1.2.1' -- title 3: 'Source: DM, VS' -- title 4: 'Subject Listing with Vital Signs by Visit¹' -- title 5: 'All Randomized Patients' -- footnote 1: '¹ Baseline through completion of study or early termination.' -- footnote 2: 'Values flagged with † were excluded from the by-visit analysis in tables showing the qualitative test results.' -- page_footer: left=Date: 09OCT2022 19:18:50 center=Archytas right=Page [pg] of [tpg] +- line size/count: 9/36 +- page_header: left=Sponsor: Company right=Study: ABC +- footnote 1: 'Program: DM_Figure.R' +- page_footer: left=Date Produced: 06Sep23 21:06 center= right=Page [pg] of [tpg] - content: -# A table specification: -- data: tibble 'final' 554 rows 36 cols -- show_cols: none -- use_attributes: all -- width: 9 -- stub: BASELINE TREATMENT 'Subject/Treatment' align='left' -- define: BASELINE dedupe='TRUE' -- define: TREATMENT -- define: VISIT 'Visit' -- define: TEMP 'Temperature' -- define: PULSE 'Pulse' -- define: RESP 'Respirations' -- define: BP 'Blood Pressure' -- define: USUBJID visible='FALSE' -- define: PG visible='FALSE' page_break='TRUE' +# A plot specification: +- height: 4.5 +- width: 7 +- title 1: 'Figure 3.2' +- title 2: 'Distribution of Subjects by Treatment Group' lib_sync: synchronized data in library 'sdtm' lib_unload: library 'sdtm' unloaded ========================================================================= -Log End Time: 2022-10-09 19:18:56 -Log Elapsed Time: 0 00:00:12 +Log End Time: 2023-09-06 21:06:43.938549 +Log Elapsed Time: 0 00:00:03 ========================================================================= ``` diff --git a/vignettes/sassy-profile.Rmd b/vignettes/sassy-profile.Rmd index 8577c0f..8b254ad 100644 --- a/vignettes/sassy-profile.Rmd +++ b/vignettes/sassy-profile.Rmd @@ -29,7 +29,6 @@ Note the following about this example: * The program makes extensive use of user-defined formats from the **fmtr** package. ```{r eval=FALSE, echo=TRUE} -library(dplyr) library(sassy) options("logr.notes" = FALSE, @@ -48,10 +47,10 @@ sep("Get data") # Get sample data path pth <- system.file("extdata", package = "sassy") - +put("Open data library") libname(sdtm, pth, "csv") - +put("Load data into environment") lib_load(sdtm) @@ -68,7 +67,7 @@ labels(sdtm.DM) <- list(ARM = "Treatment Group", RACE = "Race", BRTHDTC = "Birth Date", ARMCD = "Treatment Code" - ) |> put() +) |> put() put("AE labels") labels(sdtm.AE) <- list(AESTDTC = "Event Start Date", AEENDTC = "Event Stop Date", @@ -110,7 +109,7 @@ armfmt <- value(condition(x == "ARM A", "Placebo"), condition(x == "ARM B", "Dose 50mg"), condition(x == "ARM C", "Dose 100mg"), condition(x == "ARM D", "Competitor")) - + formats(sdtm.DM) <- list(SEX = sexfmt, RACE = racefmt, @@ -125,16 +124,18 @@ formats(sdtm.AE) <- list(AESEV = sevfmt, sep("Prepare data") -dm <- sdtm.DM |> - select(USUBJID, ARM, SITEID, SUBJID, SEX, AGE, RACE, BRTHDTC) |> put() +put("Select desired columns from DM dataset") +datastep(sdtm.DM, + keep = v(USUBJID, ARM, SITEID, SUBJID, SEX, AGE, RACE, BRTHDTC), {}) -> dm + # Split dm data by subject id dmlst <- split(dm, factor(dm$USUBJID)) - -ae <- sdtm.AE |> - select(USUBJID, AESTDTC, AEENDTC, AESTDY, - AEENDY, AESOC, AESEV, AESER, AEREL) |> put() +put("Select desired columns from AE dataset") +datastep(sdtm.AE, + keep = v(USUBJID, AESTDTC, AEENDTC, AESTDY, + AEENDY, AESOC, AESEV, AESER, AEREL), {}) -> ae # Split ae data by subject id aelst <- split(ae, factor(ae$USUBJID)) @@ -171,11 +172,11 @@ for (id in names(dmlst)) { "06=Investigational product discontinued, 07=Transfusion performed,", "88=Other")) } - + # Append table content rpt <- rpt |> add_content(tb1, page_break = FALSE) |> - add_content(tb2) - + add_content(tb2) + } put("Write out report") @@ -212,38 +213,35 @@ Here is page 11 out of 87 pages in the output report: Here is most of the log from the above program: ``` ========================================================================= -Log Path: C:/Users/dbosa/AppData/Local/Temp/Rtmp8cFaMB/log/example8.log -Program Path: C:/packages/Testing/Example8.R -Working Directory: C:/packages/Testing +Log Path: C:/Users/dbosa/AppData/Local/Temp/Rtmp6lCP5X/log/example8.log +Program Path: C:/packages/Testing/procs/ProcsPatientProfile.R +Working Directory: C:/packages/Testing/procs User Name: dbosa -R Version: 4.2.0 (2022-04-22 ucrt) +R Version: 4.3.1 (2023-06-16 ucrt) Machine: SOCRATES x86-64 -Operating System: Windows 10 x64 build 19044 -Base Packages: stats graphics grDevices utils datasets methods base -Other Packages: tidylog_1.0.2 magrittr_2.0.3 reporter_1.3.3 libr_1.2.3 fmtr_1.5.8 - common_1.0.1 logr_1.3.1 sassy_1.0.7 forcats_0.5.1 stringr_1.4.0 - dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.7 - ggplot2_3.3.6 tidyverse_1.3.1 cranlogs_2.1.1 -Log Start Time: 2022-07-21 22:31:09 +Operating System: Windows 10 x64 build 22621 +Base Packages: stats graphics grDevices utils datasets methods base Other +Packages: tidylog_1.0.2 ggplot2_3.4.2 patchwork_1.1.3 procs_1.0.3 +reporter_1.4.1 libr_1.2.8 fmtr_1.5.9 logr_1.3.4 common_1.0.8 sassy_1.2.0 +Log Start Time: 2023-09-06 21:24:18.59308 ========================================================================= ========================================================================= Get data ========================================================================= -# library 'sdtm': 8 items +# library 'sdtm': 7 items - attributes: csv not loaded -- path: C:/Users/dbosa/AppData/Local/R/win-library/4.2/reporter/extdata +- path: C:/Users/dbosa/AppData/Local/R/win-library/4.3/sassy/extdata - items: Name Extension Rows Cols Size LastModified -1 AE csv 150 27 88.5 Kb 2022-07-10 08:49:03 -2 DA csv 3587 18 528.2 Kb 2022-07-10 08:49:03 -3 DM csv 87 24 45.5 Kb 2022-07-10 08:49:03 -4 DS csv 174 9 34.1 Kb 2022-07-10 08:49:03 -5 EX csv 84 11 26.4 Kb 2022-07-10 08:49:03 -6 IE csv 2 14 13.4 Kb 2022-07-10 08:49:03 -7 SV csv 685 10 70.3 Kb 2022-07-10 08:49:03 -8 VS csv 3358 17 467.4 Kb 2022-07-10 08:49:03 +1 AE csv 150 27 88.5 Kb 2023-09-06 21:14:37 +2 DM csv 87 24 45.5 Kb 2023-09-06 21:14:37 +3 DS csv 174 9 34.1 Kb 2023-09-06 21:14:37 +4 EX csv 84 11 26.4 Kb 2023-09-06 21:14:37 +5 IE csv 2 14 13.4 Kb 2023-09-06 21:14:37 +6 SV csv 685 10 70.3 Kb 2023-09-06 21:14:37 +7 VS csv 3358 17 467.4 Kb 2023-09-06 21:14:37 lib_load: library 'sdtm' loaded @@ -351,7 +349,9 @@ Apply formats Prepare data ========================================================================= -select: dropped 16 variables (STUDYID, DOMAIN, RFSTDTC, RFENDTC, RFXSTDTC, …) +Select desired columns from DM dataset + +datastep: columns decreased from 24 to 8 # A tibble: 87 × 8 USUBJID ARM SITEID SUBJID SEX AGE RACE BRTHDTC @@ -366,24 +366,28 @@ select: dropped 16 variables (STUDYID, DOMAIN, RFSTDTC, RFENDTC, RFXSTDTC, …) 8 ABC-01-056 ARM A 01 056 M 31 WHITE 1975-05-02 9 ABC-01-113 ARM D 01 113 M 74 WHITE 1932-02-08 10 ABC-01-114 ARM B 01 114 F 72 WHITE 1934-07-09 -# … with 77 more rows +# ℹ 77 more rows +# ℹ Use `print(n = ...)` to see more rows + +Select desired columns from AE dataset -select: dropped 18 variables (STUDYID, DOMAIN, AESEQ, AETERM, AELLT, …) +datastep: columns decreased from 27 to 9 # A tibble: 150 × 9 - USUBJID AESTDTC AEENDTC AESTDY AEENDY AESOC AESEV AESER AEREL - - 1 ABC-01-049 2006-12-28 2007-03-13 52 127 Investigations MODERATE N NOT RELATED - 2 ABC-01-049 2006-12-28 2007-03-13 52 127 Investigations MODERATE N NOT RELATED - 3 ABC-01-049 2007 2007 NA NA Nervous system disorders MILD N NOT RELATED - 4 ABC-01-049 2007-01-11 2007-03-13 66 127 Investigations MODERATE N NOT RELATED - 5 ABC-01-049 2007 2007 NA NA Musculoskeletal and connective tissue disorders MILD N NOT RELATED - 6 ABC-01-050 2006-11-08 2006-11-15 7 14 Skin and subcutaneous tissue disorders MILD N NOT RELATED - 7 ABC-01-050 2006-12-17 2006-12-17 46 46 Respiratory, thoracic and mediastinal disorders MILD N NOT RELATED - 8 ABC-01-051 2007-01-01 2007-01-01 61 61 Nervous system disorders MILD N NOT RELATED - 9 ABC-01-051 2007-03-06 2007-03-09 125 128 Nervous system disorders MILD N NOT RELATED -10 ABC-01-051 2007-11-12 2007-11-14 376 378 Nervous system disorders MILD N NOT RELATED -# … with 140 more rows + USUBJID AESTDTC AEENDTC AESTDY AEENDY AESOC AESEV AESER AEREL + + 1 ABC-01-049 2006-12-28 2007-03-13 52 127 Investigations MODE… N NOT … + 2 ABC-01-049 2006-12-28 2007-03-13 52 127 Investigations MODE… N NOT … + 3 ABC-01-049 2007 2007 NA NA Nervous system diso… MILD N NOT … + 4 ABC-01-049 2007-01-11 2007-03-13 66 127 Investigations MODE… N NOT … + 5 ABC-01-049 2007 2007 NA NA Musculoskeletal and… MILD N NOT … + 6 ABC-01-050 2006-11-08 2006-11-15 7 14 Skin and subcutaneo… MILD N NOT … + 7 ABC-01-050 2006-12-17 2006-12-17 46 46 Respiratory, thorac… MILD N NOT … + 8 ABC-01-051 2007-01-01 2007-01-01 61 61 Nervous system diso… MILD N NOT … + 9 ABC-01-051 2007-03-06 2007-03-09 125 128 Nervous system diso… MILD N NOT … +10 ABC-01-051 2007-11-12 2007-11-14 376 378 Nervous system diso… MILD N NOT … +# ℹ 140 more rows +# ℹ Use `print(n = ...)` to see more rows ========================================================================= Create report @@ -392,7 +396,7 @@ Create report Write out report # A report specification: 87 pages -- file_path: 'C:\Users\dbosa\AppData\Local\Temp\Rtmp8cFaMB/output/example6.docx' +- file_path: 'C:\Users\dbosa\AppData\Local\Temp\Rtmp6lCP5X/output/example8.docx' - output_type: DOCX - units: inches - orientation: landscape @@ -419,50 +423,8 @@ Write out report - define: AESOC width=2 - define: AESTDY align='left' - define: AEENDY align='left' -# A table specification: -- data: tibble 'dm_sub' 1 rows 8 cols -- show_cols: all -- use_attributes: all -- width: 8 -- title 1: 'Listing 1.1 Subjects Narratives of Adverse Events' -- title 2: 'Subject: ABC-01-050' -- define: AGE align='left' -# A table specification: -- data: tibble 'ae_sub' 2 rows 9 cols -- show_cols: all -- use_attributes: all -- width: 8 -- footnote 1: 'ᵃSeverity: 01=Mild, 02=Moderate, 03=Severe, 04=Life Threatening, 05=Fatal' -- footnote 2: 'ᵇAction Taken: 01=None, 02=Investigational product dose altered, 03=Medication taken, 04=Hospitalized, 05=Removed from study, 06=Investigational product discontinued, 07=Transfusion performed,88=Other' -- spanning_header: from='AESTDY' to='AEENDY' 'Study Day' level=1 -- define: USUBJID visible='FALSE' -- define: AESOC width=2 -- define: AESTDY align='left' -- define: AEENDY align='left' - ... -# A table specification: -- data: tibble 'dm_sub' 1 rows 8 cols -- show_cols: all -- use_attributes: all -- width: 8 -- title 1: 'Listing 1.1 Subjects Narratives of Adverse Events' -- title 2: 'Subject: ABC-09-140' -- define: AGE align='left' -# A table specification: -- data: tibble 'ae_sub' 2 rows 9 cols -- show_cols: all -- use_attributes: all -- width: 8 -- footnote 1: 'ᵃSeverity: 01=Mild, 02=Moderate, 03=Severe, 04=Life Threatening, 05=Fatal' -- footnote 2: 'ᵇAction Taken: 01=None, 02=Investigational product dose altered, 03=Medication taken, 04=Hospitalized, 05=Removed from study, 06=Investigational product discontinued, 07=Transfusion performed,88=Other' -- spanning_header: from='AESTDY' to='AEENDY' 'Study Day' level=1 -- define: USUBJID visible='FALSE' -- define: AESOC width=2 -- define: AESTDY align='left' -- define: AEENDY align='left' - ========================================================================= Clean up ========================================================================= @@ -472,8 +434,8 @@ lib_sync: synchronized data in library 'sdtm' lib_unload: library 'sdtm' unloaded ========================================================================= -Log End Time: 2022-07-21 22:31:15 -Log Elapsed Time: 0 00:00:05 +Log End Time: 2023-09-06 21:24:25.764916 +Log Elapsed Time: 0 00:00:07 ========================================================================= ```