From 7054a911d61f078644703687f959595d52a9cc16 Mon Sep 17 00:00:00 2001 From: Emily de la Rua Date: Tue, 10 Oct 2023 10:59:55 -0400 Subject: [PATCH 1/3] Update functions affected by wrapping change --- R/summarize_coxreg.R | 3 +- R/summarize_num_patients.R | 3 +- .../testthat/_snaps/summarize_num_patients.md | 34 +++++++++---------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/R/summarize_coxreg.R b/R/summarize_coxreg.R index 382cff2862..0e19cdb554 100644 --- a/R/summarize_coxreg.R +++ b/R/summarize_coxreg.R @@ -448,7 +448,8 @@ summarize_coxreg <- function(lyt, lyt <- lyt %>% analyze_colvars( afun = a_coxreg, - extra_args = list(variables = variables, at = at, control = control, multivar = multivar, labelstr = "") + extra_args = list(variables = variables, at = at, control = control, multivar = multivar, labelstr = ""), + indent_mod = if (!"arm" %in% names(variables) || multivar) 0L else -1L ) } } diff --git a/R/summarize_num_patients.R b/R/summarize_num_patients.R index f83b072fc7..5c51b1ba24 100644 --- a/R/summarize_num_patients.R +++ b/R/summarize_num_patients.R @@ -54,7 +54,8 @@ s_num_patients <- function(x, labelstr, .N_col, count_by = NULL, unique_count_su out <- list( unique = formatters::with_label(c(count1, ifelse(count1 == 0 && .N_col == 0, 0, count1 / .N_col)), labelstr), nonunique = formatters::with_label(count2, labelstr), - unique_count = formatters::with_label(count1, ifelse(unique_count_suffix, paste(labelstr, "(n)"), labelstr)) + unique_count = formatters::with_label( + count1, ifelse(unique_count_suffix, paste0(labelstr, if (nzchar(labelstr)) " ", "(n)"), labelstr)) ) out diff --git a/tests/testthat/_snaps/summarize_num_patients.md b/tests/testthat/_snaps/summarize_num_patients.md index b18211cbfb..fb4b2d2276 100644 --- a/tests/testthat/_snaps/summarize_num_patients.md +++ b/tests/testthat/_snaps/summarize_num_patients.md @@ -16,7 +16,7 @@ $unique_count [1] 3 attr(,"label") - [1] " (n)" + [1] "(n)" # s_num_patients works as expected with empty input @@ -37,7 +37,7 @@ $unique_count [1] 0 attr(,"label") - [1] " (n)" + [1] "(n)" # s_num_patients works as expected with unique_count_suffix = FALSE @@ -79,7 +79,7 @@ $unique_count [1] 3 attr(,"label") - [1] " (n)" + [1] "(n)" # summarize_num_patients works as expected with healthy input @@ -119,10 +119,10 @@ Code res Output - A B - (N=5) (N=4) - ———————————————————— - (n) 3 3 + A B + (N=5) (N=4) + ——————————————————— + (n) 3 3 # s_num_patients count_by works as expected with healthy input @@ -142,7 +142,7 @@ $unique_count [1] 3 attr(,"label") - [1] " (n)" + [1] "(n)" # s_num_patients count_by with missing works as expected with healthy input @@ -163,7 +163,7 @@ $unique_count [1] 3 attr(,"label") - [1] " (n)" + [1] "(n)" # s_num_patients count_by with missing case 2 works as expected with healthy input @@ -184,7 +184,7 @@ $unique_count [1] 3 attr(,"label") - [1] " (n)" + [1] "(n)" # s_num_patients_content with count_by works as expected with healthy input @@ -205,7 +205,7 @@ $unique_count [1] 3 attr(,"label") - [1] " (n)" + [1] "(n)" # s_num_patients_content with count_by case 2 works as expected with healthy input @@ -226,7 +226,7 @@ $unique_count [1] 3 attr(,"label") - [1] " (n)" + [1] "(n)" # s_num_patients_content with count_by trivial cases, identical to without count_by @@ -247,7 +247,7 @@ $unique_count [1] 4 attr(,"label") - [1] " (n)" + [1] "(n)" # summarize_num_patients with count_by works as expected with healthy input @@ -287,10 +287,10 @@ Code res Output - A B - (N=5) (N=4) - ———————————————————— - (n) 3 3 + A B + (N=5) (N=4) + ——————————————————— + (n) 3 3 # summarize_num_patients with count_by different combinations works as expected with healthy input From c20daa83cfefca45a55a8f3fa65ca9638298875b Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:04:47 +0000 Subject: [PATCH 2/3] [skip actions] Restyle files --- R/summarize_num_patients.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/summarize_num_patients.R b/R/summarize_num_patients.R index 5c51b1ba24..8883eb2f1b 100644 --- a/R/summarize_num_patients.R +++ b/R/summarize_num_patients.R @@ -55,7 +55,8 @@ s_num_patients <- function(x, labelstr, .N_col, count_by = NULL, unique_count_su unique = formatters::with_label(c(count1, ifelse(count1 == 0 && .N_col == 0, 0, count1 / .N_col)), labelstr), nonunique = formatters::with_label(count2, labelstr), unique_count = formatters::with_label( - count1, ifelse(unique_count_suffix, paste0(labelstr, if (nzchar(labelstr)) " ", "(n)"), labelstr)) + count1, ifelse(unique_count_suffix, paste0(labelstr, if (nzchar(labelstr)) " ", "(n)"), labelstr) + ) ) out From 44a8fe6ad174d2bfbd5d20dba5f051388742c444 Mon Sep 17 00:00:00 2001 From: Emily de la Rua Date: Tue, 10 Oct 2023 11:06:07 -0400 Subject: [PATCH 3/3] Empty commit