From d2403b976dc80a38a07b5b33e9efbf4cbcd5d133 Mon Sep 17 00:00:00 2001 From: benoit Date: Fri, 4 Feb 2022 15:50:01 +0100 Subject: [PATCH 1/2] correct format --- R/dst01.R | 41 +++++++++++++++++++++------------ R/standard_data_preprocessing.R | 2 +- man/dst01_1.Rd | 4 ++-- man/dst01_2.Rd | 4 ++-- man/dst01_3.Rd | 4 ++-- 5 files changed, 33 insertions(+), 22 deletions(-) diff --git a/R/dst01.R b/R/dst01.R index efa929e5ce..df68e914d9 100644 --- a/R/dst01.R +++ b/R/dst01.R @@ -60,7 +60,7 @@ dst01_1 <- function(adam_db, deco = std_deco("DST01"), .study = list( armvar = "ARM", - lbl_overall = "All patients", + lbl_overall = "All Patients", disc_reason_var = "DCSREAS" )) { check_dst01_1_args( @@ -147,7 +147,7 @@ dst01_1_lyt <- function(armvar = .study$armvar, deco = std_deco("DST01"), .study = list( armvar = "ARM", - lbl_overall = "All patients", + lbl_overall = "All Patients", status = "EOSSTT", disc_reason_var = "DCSREAS" )) { @@ -161,7 +161,8 @@ dst01_1_lyt <- function(armvar = .study$armvar, count_values( vars = status, values = completed_lbl, - .labels = c(count_fraction = "Completed Study") + .labels = c(count_fraction = "Completed Study"), + .formats = "xx (xx.x%)" ) layout_table_other <- @@ -169,17 +170,19 @@ dst01_1_lyt <- function(armvar = .study$armvar, count_values( vars = status, values = ongoing_lbl, - .labels = c(count_fraction = "Ongoing Study") + .labels = c(count_fraction = "Ongoing"), + .formats = "xx (xx.x%)" ) %>% split_rows_by( status, split_fun = keep_split_levels(discontinued_lbl), ) %>% - summarize_row_groups(label_fstr = "Discontinued Study") %>% + summarize_row_groups(label_fstr = "Discontinued Study", format = "xx (xx.x%)") %>% summarize_vars( disc_reason_var, .stats = "count_fraction", - denom = "N_col" + denom = "N_col", + formats = "xx (xx.x%)" ) list(layout_table_completed, layout_table_other) @@ -231,9 +234,10 @@ dst01_2 <- function(adam_db, deco = std_deco("DST01"), .study = list( armvar = "ARM", - lbl_overall = "All patients", + lbl_overall = "All Patients", disc_reason_var = "DCSREAS" )) { + check_dst01_1_args( reason = disc_reason_var, status = status_var @@ -316,7 +320,7 @@ dst01_2_lyt <- function(armvar = .study$armvar, deco = std_deco("DST01"), .study = list( armvar = "ARM", - lbl_overall = "All patients", + lbl_overall = "All Patients", status = "EOSSTT", disc_reason_var = "DCSREAS" )) { @@ -329,14 +333,16 @@ dst01_2_lyt <- function(armvar = .study$armvar, count_values( vars = status, values = completed_lbl, - .labels = c(count_fraction = "Completed Study") + .labels = c(count_fraction = "Completed Study"), + .formats = "xx (xx.x%)" ) layout_table_other <- layout_table %>% count_values( vars = status, values = ongoing_lbl, - .labels = c(count_fraction = "Ongoing Study") + .labels = c(count_fraction = "Ongoing"), + .formats = "xx (xx.x%)" ) %>% split_rows_by( var = status, @@ -345,13 +351,14 @@ dst01_2_lyt <- function(armvar = .study$armvar, summarize_row_groups(label_fstr = "Discontinued Study") %>% split_rows_by( "reasonGP", - split_fun = reorder_split_levels(neworder = c("Safety", "Non Safety")) + split_fun = reorder_split_levels(neworder = c("Safety", "Non-safety")) ) %>% - summarize_row_groups() %>% + summarize_row_groups(format = "xx (xx.x%)") %>% summarize_vars( disc_reason_var, .stats = "count_fraction", - denom = "N_col" + denom = "N_col", + formats = "xx (xx.x%)" ) list(completed = layout_table_completed, other = layout_table_other) @@ -408,7 +415,7 @@ dst01_3 <- function(adam_db, .study = list( armvar = "ARM", disc_reason_var = "DCSREAS", - lbl_overall = "All patients" + lbl_overall = "All Patients" )) { check_dst01_1_args( reason = disc_reason_var, @@ -515,7 +522,7 @@ dst01_3_lyt <- function(armvar = .study$armvar, deco = std_deco("DST01"), .study = list( armvar = "ARM", - lbl_overall = "All patients", + lbl_overall = "All Patients", status_treatment = "EOTSTT" )) { layout_table <- basic_table_deco(deco) %>% @@ -526,18 +533,22 @@ dst01_3_lyt <- function(armvar = .study$armvar, vars = status_treatment, values = completed_lbl, .labels = c(count_fraction = "Completed Treatment"), + .formats = "xx (xx.x%)", table_names = c("COMPLETED") + ) %>% count_values( vars = status_treatment, values = ongoing_lbl, .labels = c(count_fraction = "Ongoing Treatment"), + .formats = "xx (xx.x%)", table_names = c("ONGOING") ) %>% count_values( vars = status_treatment, values = discontinued_lbl, .labels = c(count_fraction = "Discontinued Treatment"), + .formats = "xx (xx.x%)", table_names = c("DISCONTINUED") ) } diff --git a/R/standard_data_preprocessing.R b/R/standard_data_preprocessing.R index 9e0df6dd82..feba0a8118 100644 --- a/R/standard_data_preprocessing.R +++ b/R/standard_data_preprocessing.R @@ -366,7 +366,7 @@ mutate_adsl_gp <- function(adam_db, mutate(reasonGP = case_when( !!sym_reason %in% c("ADVERSE EVENT", "DEATH") ~ "Safety", !!sym_reason == "" ~ "", - TRUE ~ "Non Safety" + TRUE ~ "Non-safety" )) %>% dm_update_zoomed() } diff --git a/man/dst01_1.Rd b/man/dst01_1.Rd index b2bacc4a8a..15484fe491 100644 --- a/man/dst01_1.Rd +++ b/man/dst01_1.Rd @@ -13,7 +13,7 @@ dst01_1( prune_0 = TRUE, lbl_overall = .study$lbl_overall, deco = std_deco("DST01"), - .study = list(armvar = "ARM", lbl_overall = "All patients", disc_reason_var = + .study = list(armvar = "ARM", lbl_overall = "All Patients", disc_reason_var = "DCSREAS") ) @@ -26,7 +26,7 @@ dst01_1_lyt( discontinued_lbl = "DISCONTINUED", lbl_overall = .study$lbl_overall, deco = std_deco("DST01"), - .study = list(armvar = "ARM", lbl_overall = "All patients", status = "EOSSTT", + .study = list(armvar = "ARM", lbl_overall = "All Patients", status = "EOSSTT", disc_reason_var = "DCSREAS") ) } diff --git a/man/dst01_2.Rd b/man/dst01_2.Rd index f412dd1992..032aebc7cd 100644 --- a/man/dst01_2.Rd +++ b/man/dst01_2.Rd @@ -13,7 +13,7 @@ dst01_2( lbl_overall = .study$lbl_overall, prune_0 = TRUE, deco = std_deco("DST01"), - .study = list(armvar = "ARM", lbl_overall = "All patients", disc_reason_var = + .study = list(armvar = "ARM", lbl_overall = "All Patients", disc_reason_var = "DCSREAS") ) @@ -26,7 +26,7 @@ dst01_2_lyt( discontinued_lbl = "DISCONTINUED", lbl_overall = .study$lbl_overall, deco = std_deco("DST01"), - .study = list(armvar = "ARM", lbl_overall = "All patients", status = "EOSSTT", + .study = list(armvar = "ARM", lbl_overall = "All Patients", status = "EOSSTT", disc_reason_var = "DCSREAS") ) } diff --git a/man/dst01_3.Rd b/man/dst01_3.Rd index 92119cd073..b646388ffa 100644 --- a/man/dst01_3.Rd +++ b/man/dst01_3.Rd @@ -15,7 +15,7 @@ dst01_3( prune_0 = TRUE, deco = std_deco("DST01"), .study = list(armvar = "ARM", disc_reason_var = "DCSREAS", lbl_overall = - "All patients") + "All Patients") ) dst01_3_lyt( @@ -26,7 +26,7 @@ dst01_3_lyt( ongoing_lbl = "ONGOING", lbl_overall = .study$lbl_overall, deco = std_deco("DST01"), - .study = list(armvar = "ARM", lbl_overall = "All patients", status_treatment = + .study = list(armvar = "ARM", lbl_overall = "All Patients", status_treatment = "EOTSTT") ) } From c841d14cef9f3a94b2d9a6fd8322b754270ebfed Mon Sep 17 00:00:00 2001 From: benoit Date: Thu, 10 Mar 2022 17:02:01 +0100 Subject: [PATCH 2/2] styler --- R/dst01.R | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/R/dst01.R b/R/dst01.R index df68e914d9..f6339138e1 100644 --- a/R/dst01.R +++ b/R/dst01.R @@ -237,7 +237,6 @@ dst01_2 <- function(adam_db, lbl_overall = "All Patients", disc_reason_var = "DCSREAS" )) { - check_dst01_1_args( reason = disc_reason_var, status = status_var @@ -535,13 +534,12 @@ dst01_3_lyt <- function(armvar = .study$armvar, .labels = c(count_fraction = "Completed Treatment"), .formats = "xx (xx.x%)", table_names = c("COMPLETED") - ) %>% count_values( vars = status_treatment, values = ongoing_lbl, .labels = c(count_fraction = "Ongoing Treatment"), - .formats = "xx (xx.x%)", + .formats = "xx (xx.x%)", table_names = c("ONGOING") ) %>% count_values(