Skip to content

Commit

Permalink
Merge pull request #38 from Merck/DEVR-3432-validate-exposure-dur-tbl
Browse files Browse the repository at this point in the history
Check-in - DEVR-3432 validation
  • Loading branch information
wangben718 authored Sep 24, 2024
2 parents 32c6bb9 + 4aa630b commit bbfd54f
Show file tree
Hide file tree
Showing 9 changed files with 1,878 additions and 3 deletions.
12 changes: 11 additions & 1 deletion R/format_sl_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,21 @@ format_sl_summary <- function(
display_col = c("n", "prop", "total"),
digits_prop = 1,
display_stat = c("mean", "sd", "se", "median", "q1 to q3", "range")) {


n_group <- length(outdata$group_label)



# Check if the "tbl" element exists in the "outdata" object
if ("tbl" %in% names(outdata)) {
# If the element exists, delete it
outdata$tbl <- NULL
}

# Select statistics want to display
for (i in 1:length(outdata$var_type)) {
if ("numeric" %in% outdata$var_type[[i]]) {
if ( ("integer" %in% outdata$var_type[[i]]) || ("numeric" %in% outdata$var_type[[i]]) ) {
n_num <- outdata$char_n[[i]]
n_num_group <- n_num[which(!tolower(n_num$name)
%in% c(
Expand Down
3 changes: 2 additions & 1 deletion R/meta_sl_example.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ meta_sl_exposure_example <- function() {

adexsum$APERIODC <- "Base"
adexsum$APERIOD <- 1
set.seed(123)

set.seed(123) # Set a seed for reproducibility
adexsum$AVAL <- sample(x = 0:(24*7), size = length(adexsum$USUBJID), replace = TRUE)
adexsum$EXDURGR <- "not treated"
adexsum$EXDURGR[adexsum$AVAL>=1] <- ">=1 day"
Expand Down
5 changes: 4 additions & 1 deletion R/rtf_sl_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ rtf_sl_summary <- function(
path_outdata = NULL,
path_outtable = NULL) {
# Set default column width



tbl <- outdata$tbl
display_total <- "total" %in% outdata$display_col
if (display_total == TRUE) {
Expand Down Expand Up @@ -91,7 +94,7 @@ rtf_sl_summary <- function(

# Set default footnote
footnotes_stat <- NULL
if ("numeric" %in% outdata$var_type) {
if (("integer" %in% outdata$var_type) || ("numeric" %in% outdata$var_type)) {
if ("sd" %in% tolower(outdata$display_stat)) {
footnotes_stat <- c(footnotes_stat, "SD=Standard deviation")
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit bbfd54f

Please sign in to comment.