From 4976bb5dccec07ae5af250291587384215cd51a3 Mon Sep 17 00:00:00 2001 From: Ilse Augustyns Date: Fri, 27 Sep 2024 10:01:00 +0000 Subject: [PATCH] updates for snapshots + add long version of stats (mean, median, geom_mean) to s_summary.numeric --- R/analyze_variables.R | 8 + R/utils_default_stats_formats_labels.R | 7 +- tests/testthat/_snaps/analyze_variables.md | 198 +++++++++++++----- tests/testthat/_snaps/compare_variables.md | 12 +- tests/testthat/_snaps/summarize_change.md | 72 +++++++ .../utils_default_stats_formats_labels.md | 50 +++-- tests/testthat/test-utils_rtables.R | 1 + 7 files changed, 270 insertions(+), 78 deletions(-) diff --git a/R/analyze_variables.R b/R/analyze_variables.R index 69e0041607..d54aa0bac0 100644 --- a/R/analyze_variables.R +++ b/R/analyze_variables.R @@ -188,6 +188,8 @@ s_summary.numeric <- function(x, mean_sdi <- y$mean[[1]] + c(-1, 1) * stats::sd(x, na.rm = FALSE) names(mean_sdi) <- c("mean_sdi_lwr", "mean_sdi_upr") y$mean_sdi <- formatters::with_label(mean_sdi, "Mean -/+ 1xSD") + mean_long <- c(y$mean, y$mean_ci) + y$mean_long <- formatters::with_label(mean_long, paste0("Mean (", f_conf_level(control$conf_level), ")")) mean_pval <- stat_mean_pval(x, test_mean = control$test_mean, na.rm = FALSE, n_min = 2) y$mean_pval <- formatters::with_label(mean_pval, paste("Mean", f_pval(control$test_mean))) @@ -199,6 +201,9 @@ s_summary.numeric <- function(x, median_ci <- stat_median_ci(x, conf_level = control$conf_level, na.rm = FALSE, gg_helper = FALSE) y$median_ci <- formatters::with_label(median_ci, paste("Median", f_conf_level(control$conf_level))) + median_long <- c(y$median, median_ci) + y$median_long <- formatters::with_label(median_long, paste0("Median (", f_conf_level(control$conf_level), ")")) + q <- control$quantiles if (any(is.na(x))) { qnts <- rep(NA_real_, length(q)) @@ -231,6 +236,9 @@ s_summary.numeric <- function(x, y$geom_cv <- c("geom_cv" = sqrt(exp(stats::sd(log(x_no_negative_vals), na.rm = FALSE) ^ 2) - 1) * 100) # styler: off + geom_mean_long <- c(y$geom_mean, y$geom_mean_ci) + y$geom_mean_long <- formatters::with_label(geom_mean_long, paste0("Geometric Mean (", f_conf_level(control$conf_level), ")")) + y } diff --git a/R/utils_default_stats_formats_labels.R b/R/utils_default_stats_formats_labels.R index 5524ec2445..0411e32251 100644 --- a/R/utils_default_stats_formats_labels.R +++ b/R/utils_default_stats_formats_labels.R @@ -387,7 +387,8 @@ tern_default_stats <- list( "n", "sum", "mean", "sd", "se", "mean_sd", "mean_se", "mean_ci", "mean_sei", "mean_sdi", "mean_pval", "median", "mad", "median_ci", "quantiles", "iqr", "range", "min", "max", "median_range", "cv", "geom_mean", "geom_mean_ci", "geom_cv", - "mean_long", "median_long", "geom_mean_long" + "median_long", + "mean_long", "geom_mean_long" ), count_cumulative = c("count_fraction", "count_fraction_fixed_dp"), count_missed_doses = c("n", "count_fraction", "count_fraction_fixed_dp"), @@ -449,6 +450,7 @@ tern_default_formats <- c( mean_sei = "(xx.xx, xx.xx)", mean_sdi = "(xx.xx, xx.xx)", mean_pval = "x.xxxx | (<0.0001)", + mean_long = "xx.xx (xx.xx - xx.xx)", median = "xx.x", mad = "xx.x", median_ci = "(xx.xx, xx.xx)", @@ -464,6 +466,7 @@ tern_default_formats <- c( cv = "xx.x", geom_mean = "xx.x", geom_mean_ci = "(xx.xx, xx.xx)", + geom_mean_long = "xx.xx (xx.xx - xx.xx)", geom_cv = "xx.x", pval = "x.xxxx | (<0.0001)", pval_counts = "x.xxxx | (<0.0001)", @@ -501,6 +504,7 @@ tern_default_labels <- c( mean_sei = "Mean -/+ 1xSE", mean_sdi = "Mean -/+ 1xSD", mean_pval = "Mean p-value (H0: mean = 0)", + mean_long = "Mean (95% CI)", median = "Median", mad = "Median Absolute Deviation", median_ci = "Median 95% CI", @@ -516,6 +520,7 @@ tern_default_labels <- c( cv = "CV (%)", geom_mean = "Geometric Mean", geom_mean_ci = "Geometric Mean 95% CI", + geom_mean_long = "Geometric Mean (95% CI)", geom_cv = "CV % Geometric Mean", pval = "p-value (t-test)", # Default for numeric pval_counts = "p-value (chi-squared test)", # Default for counts diff --git a/tests/testthat/_snaps/analyze_variables.md b/tests/testthat/_snaps/analyze_variables.md index 65f42acee6..dc064755f7 100644 --- a/tests/testthat/_snaps/analyze_variables.md +++ b/tests/testthat/_snaps/analyze_variables.md @@ -49,6 +49,12 @@ attr(,"label") [1] "Mean -/+ 1xSD" + $mean_long + mean mean_ci_lwr mean_ci_upr + NA NA NA + attr(,"label") + [1] "Mean (95% CI)" + $mean_pval p_value NA @@ -71,6 +77,12 @@ attr(,"label") [1] "Median 95% CI" + $median_long + median median_ci_lwr median_ci_upr + NA NA NA + attr(,"label") + [1] "Median (95% CI)" + $quantiles quantile_0.25 quantile_0.75 NA NA @@ -117,6 +129,12 @@ geom_cv NA + $geom_mean_long + geom_mean mean_ci_lwr mean_ci_upr + NaN NA NA + attr(,"label") + [1] "Geometric Mean (95% CI)" + # s_summary handles NA @@ -169,6 +187,12 @@ attr(,"label") [1] "Mean -/+ 1xSD" + $mean_long + mean mean_ci_lwr mean_ci_upr + 1 NA NA + attr(,"label") + [1] "Mean (95% CI)" + $mean_pval p_value NA @@ -191,6 +215,12 @@ attr(,"label") [1] "Median 95% CI" + $median_long + median median_ci_lwr median_ci_upr + 1 NA NA + attr(,"label") + [1] "Median (95% CI)" + $quantiles quantile_0.25 quantile_0.75 1 1 @@ -237,6 +267,12 @@ geom_cv NA + $geom_mean_long + geom_mean mean_ci_lwr mean_ci_upr + 1 NA NA + attr(,"label") + [1] "Geometric Mean (95% CI)" + --- @@ -289,6 +325,12 @@ attr(,"label") [1] "Mean -/+ 1xSD" + $mean_long + mean mean_ci_lwr mean_ci_upr + NA NA NA + attr(,"label") + [1] "Mean (95% CI)" + $mean_pval p_value NA @@ -311,6 +353,12 @@ attr(,"label") [1] "Median 95% CI" + $median_long + median median_ci_lwr median_ci_upr + NA NA NA + attr(,"label") + [1] "Median (95% CI)" + $quantiles quantile_0.25 quantile_0.75 NA NA @@ -357,6 +405,12 @@ geom_cv NA + $geom_mean_long + geom_mean mean_ci_lwr mean_ci_upr + NA NA NA + attr(,"label") + [1] "Geometric Mean (95% CI)" + # s_summary returns right results for n = 2 @@ -409,6 +463,12 @@ attr(,"label") [1] "Mean -/+ 1xSD" + $mean_long + mean mean_ci_lwr mean_ci_upr + 1.500000 -4.853102 7.853102 + attr(,"label") + [1] "Mean (95% CI)" + $mean_pval p_value 0.2048328 @@ -431,6 +491,12 @@ attr(,"label") [1] "Median 95% CI" + $median_long + median median_ci_lwr median_ci_upr + 1.5 NA NA + attr(,"label") + [1] "Median (95% CI)" + $quantiles quantile_0.25 quantile_0.75 1 2 @@ -477,6 +543,12 @@ geom_cv 52.10922 + $geom_mean_long + geom_mean mean_ci_lwr mean_ci_upr + 1.41421356 0.01729978 115.60839614 + attr(,"label") + [1] "Geometric Mean (95% CI)" + # s_summary returns right results for n = 8 @@ -529,6 +601,12 @@ attr(,"label") [1] "Mean -/+ 1xSD" + $mean_long + mean mean_ci_lwr mean_ci_upr + 6.000000 3.318768 8.681232 + attr(,"label") + [1] "Mean (95% CI)" + $mean_pval p_value 0.001133783 @@ -551,6 +629,12 @@ attr(,"label") [1] "Median 95% CI" + $median_long + median median_ci_lwr median_ci_upr + 6.5 1.0 10.0 + attr(,"label") + [1] "Median (95% CI)" + $quantiles quantile_0.25 quantile_0.75 3.5 8.5 @@ -597,6 +681,12 @@ geom_cv 96.61307 + $geom_mean_long + geom_mean mean_ci_lwr mean_ci_upr + 4.842534 2.456211 9.547283 + attr(,"label") + [1] "Geometric Mean (95% CI)" + # s_summary works with factors @@ -1033,31 +1123,34 @@ Output RowsVerticalSection (in_rows) object print method: ---------------------------- - row_name formatted_cell indent_mod row_label - 1 n 10 0 n - 2 Sum 1.3 0 Sum - 3 Mean 0.1 0 Mean - 4 SD 0.8 0 SD - 5 SE 0.2 0 SE - 6 Mean (SD) 0.1 (0.8) 0 Mean (SD) - 7 Mean (SE) 0.1 (0.2) 0 Mean (SE) - 8 Mean 95% CI (-0.43, 0.69) 0 Mean 95% CI - 9 Mean -/+ 1xSE (-0.11, 0.38) 0 Mean -/+ 1xSE - 10 Mean -/+ 1xSD (-0.65, 0.91) 0 Mean -/+ 1xSD - 11 Mean p-value (H0: mean = 0) 0.6052 0 Mean p-value (H0: mean = 0) - 12 Median 0.3 0 Median - 13 Median Absolute Deviation -0.0 0 Median Absolute Deviation - 14 Median 95% CI (-0.82, 0.74) 0 Median 95% CI - 15 25% and 75%-ile -0.6 - 0.6 0 25% and 75%-ile - 16 IQR 1.2 0 IQR - 17 Min - Max -0.8 - 1.6 0 Min - Max - 18 Minimum -0.8 0 Minimum - 19 Maximum 1.6 0 Maximum - 20 Median (Min - Max) 0.3 (-0.8 - 1.6) 0 Median (Min - Max) - 21 CV (%) 590.4 0 CV (%) - 22 Geometric Mean NA 0 Geometric Mean - 23 Geometric Mean 95% CI NA 0 Geometric Mean 95% CI - 24 CV % Geometric Mean NA 0 CV % Geometric Mean + row_name formatted_cell indent_mod row_label + 1 n 10 0 n + 2 Sum 1.3 0 Sum + 3 Mean 0.1 0 Mean + 4 SD 0.8 0 SD + 5 SE 0.2 0 SE + 6 Mean (SD) 0.1 (0.8) 0 Mean (SD) + 7 Mean (SE) 0.1 (0.2) 0 Mean (SE) + 8 Mean 95% CI (-0.43, 0.69) 0 Mean 95% CI + 9 Mean -/+ 1xSE (-0.11, 0.38) 0 Mean -/+ 1xSE + 10 Mean -/+ 1xSD (-0.65, 0.91) 0 Mean -/+ 1xSD + 11 Mean p-value (H0: mean = 0) 0.6052 0 Mean p-value (H0: mean = 0) + 12 Median 0.3 0 Median + 13 Median Absolute Deviation -0.0 0 Median Absolute Deviation + 14 Median 95% CI (-0.82, 0.74) 0 Median 95% CI + 15 25% and 75%-ile -0.6 - 0.6 0 25% and 75%-ile + 16 IQR 1.2 0 IQR + 17 Min - Max -0.8 - 1.6 0 Min - Max + 18 Minimum -0.8 0 Minimum + 19 Maximum 1.6 0 Maximum + 20 Median (Min - Max) 0.3 (-0.8 - 1.6) 0 Median (Min - Max) + 21 CV (%) 590.4 0 CV (%) + 22 Geometric Mean NA 0 Geometric Mean + 23 Geometric Mean 95% CI NA 0 Geometric Mean 95% CI + 24 CV % Geometric Mean NA 0 CV % Geometric Mean + 25 Median (95% CI) 0.26 (-0.82 - 0.74) 0 Median (95% CI) + 26 Mean (95% CI) 0.13 (-0.43 - 0.69) 0 Mean (95% CI) + 27 Geometric Mean (95% CI) NA 0 Geometric Mean (95% CI) --- @@ -1165,32 +1258,35 @@ Output RowsVerticalSection (in_rows) object print method: ---------------------------- - row_name formatted_cell indent_mod row_label - 1 n 10 0 n - 2 Sum 51.3 0 Sum - 3 Mean 5.1 0 Mean - 4 SD 0.8 0 SD - 5 SE 0.2 0 SE - 6 Mean (SD) 5.1 (0.8) 0 Mean (SD) - 7 Mean (SE) 5.1 (0.2) 0 Mean (SE) - 8 Mean 95% CI (4.57, 5.69) 0 Mean 95% CI - 9 Mean -/+ 1xSE (4.89, 5.38) 0 Mean -/+ 1xSE - 10 Mean -/+ 1xSD (4.35, 5.91) 0 Mean -/+ 1xSD - 11 Mean p-value (H0: mean = 0) <0.0001 0 Mean p-value (H0: mean = 0) - 12 Median 5.3 0 Median - 13 Median Absolute Deviation -0.0 0 Median Absolute Deviation - 14 Median 95% CI (4.18, 5.74) 0 Median 95% CI - 15 25% and 75%-ile 4.4 - 5.6 0 25% and 75%-ile - 16 IQR 1.2 0 IQR - 17 Min - Max 4.2 - 6.6 0 Min - Max - 18 Minimum 4.2 0 Minimum - 19 Maximum 6.6 0 Maximum - 20 Median (Min - Max) 5.3 (4.2 - 6.6) 0 Median (Min - Max) - 21 CV (%) 15.2 0 CV (%) - 22 Geometric Mean 5.1 0 Geometric Mean - 23 Geometric Mean 95% CI (4.56, 5.66) 0 Geometric Mean 95% CI - 24 CV % Geometric Mean 15.2 0 CV % Geometric Mean - 25 p-value (t-test) <0.0001 0 p-value (t-test) + row_name formatted_cell indent_mod row_label + 1 n 10 0 n + 2 Sum 51.3 0 Sum + 3 Mean 5.1 0 Mean + 4 SD 0.8 0 SD + 5 SE 0.2 0 SE + 6 Mean (SD) 5.1 (0.8) 0 Mean (SD) + 7 Mean (SE) 5.1 (0.2) 0 Mean (SE) + 8 Mean 95% CI (4.57, 5.69) 0 Mean 95% CI + 9 Mean -/+ 1xSE (4.89, 5.38) 0 Mean -/+ 1xSE + 10 Mean -/+ 1xSD (4.35, 5.91) 0 Mean -/+ 1xSD + 11 Mean p-value (H0: mean = 0) <0.0001 0 Mean p-value (H0: mean = 0) + 12 Median 5.3 0 Median + 13 Median Absolute Deviation -0.0 0 Median Absolute Deviation + 14 Median 95% CI (4.18, 5.74) 0 Median 95% CI + 15 25% and 75%-ile 4.4 - 5.6 0 25% and 75%-ile + 16 IQR 1.2 0 IQR + 17 Min - Max 4.2 - 6.6 0 Min - Max + 18 Minimum 4.2 0 Minimum + 19 Maximum 6.6 0 Maximum + 20 Median (Min - Max) 5.3 (4.2 - 6.6) 0 Median (Min - Max) + 21 CV (%) 15.2 0 CV (%) + 22 Geometric Mean 5.1 0 Geometric Mean + 23 Geometric Mean 95% CI (4.56, 5.66) 0 Geometric Mean 95% CI + 24 CV % Geometric Mean 15.2 0 CV % Geometric Mean + 25 Median (95% CI) 5.26 (4.18 - 5.74) 0 Median (95% CI) + 26 Mean (95% CI) 5.13 (4.57 - 5.69) 0 Mean (95% CI) + 27 Geometric Mean (95% CI) 5.08 (4.56 - 5.66) 0 Geometric Mean (95% CI) + 28 p-value (t-test) <0.0001 0 p-value (t-test) --- diff --git a/tests/testthat/_snaps/compare_variables.md b/tests/testthat/_snaps/compare_variables.md index 493db5697c..0cacb94c3c 100644 --- a/tests/testthat/_snaps/compare_variables.md +++ b/tests/testthat/_snaps/compare_variables.md @@ -3,11 +3,13 @@ Code res Output - [1] "n" "sum" "mean" "sd" "se" - [6] "mean_sd" "mean_se" "mean_ci" "mean_sei" "mean_sdi" - [11] "mean_pval" "median" "mad" "median_ci" "quantiles" - [16] "iqr" "range" "min" "max" "median_range" - [21] "cv" "geom_mean" "geom_mean_ci" "geom_cv" "pval" + [1] "n" "sum" "mean" "sd" + [5] "se" "mean_sd" "mean_se" "mean_ci" + [9] "mean_sei" "mean_sdi" "mean_long" "mean_pval" + [13] "median" "mad" "median_ci" "median_long" + [17] "quantiles" "iqr" "range" "min" + [21] "max" "median_range" "cv" "geom_mean" + [25] "geom_mean_ci" "geom_cv" "geom_mean_long" "pval" # s_compare for numeric does not give p-value when not at least 2 values in each group diff --git a/tests/testthat/_snaps/summarize_change.md b/tests/testthat/_snaps/summarize_change.md index b0e8774d89..f46df79af1 100644 --- a/tests/testthat/_snaps/summarize_change.md +++ b/tests/testthat/_snaps/summarize_change.md @@ -49,6 +49,12 @@ attr(,"label") [1] "Mean -/+ 1xSD" + $mean_long + mean mean_ci_lwr mean_ci_upr + NA NA NA + attr(,"label") + [1] "Mean (95% CI)" + $mean_pval p_value NA @@ -71,6 +77,12 @@ attr(,"label") [1] "Median 95% CI" + $median_long + median median_ci_lwr median_ci_upr + NA NA NA + attr(,"label") + [1] "Median (95% CI)" + $quantiles quantile_0.25 quantile_0.75 NA NA @@ -117,6 +129,12 @@ geom_cv NA + $geom_mean_long + geom_mean mean_ci_lwr mean_ci_upr + NaN NA NA + attr(,"label") + [1] "Geometric Mean (95% CI)" + # s_change_from_baseline handles NA in baseline values @@ -169,6 +187,12 @@ attr(,"label") [1] "Mean -/+ 1xSD" + $mean_long + mean mean_ci_lwr mean_ci_upr + 3.000000 -4.452413 10.452413 + attr(,"label") + [1] "Mean (95% CI)" + $mean_pval p_value 0.2254033 @@ -191,6 +215,12 @@ attr(,"label") [1] "Median 95% CI" + $median_long + median median_ci_lwr median_ci_upr + 3 NA NA + attr(,"label") + [1] "Median (95% CI)" + $quantiles quantile_0.25 quantile_0.75 0 6 @@ -237,6 +267,12 @@ geom_cv NA + $geom_mean_long + geom_mean mean_ci_lwr mean_ci_upr + NA NA NA + attr(,"label") + [1] "Geometric Mean (95% CI)" + # s_change_from_baseline handles baseline substitution @@ -290,6 +326,12 @@ attr(,"label") [1] "Mean -/+ 1xSD" + $`FALSE`$mean_long + mean mean_ci_lwr mean_ci_upr + 1.500000 -4.853102 7.853102 + attr(,"label") + [1] "Mean (95% CI)" + $`FALSE`$mean_pval p_value 0.2048328 @@ -312,6 +354,12 @@ attr(,"label") [1] "Median 95% CI" + $`FALSE`$median_long + median median_ci_lwr median_ci_upr + 1.5 NA NA + attr(,"label") + [1] "Median (95% CI)" + $`FALSE`$quantiles quantile_0.25 quantile_0.75 1 2 @@ -358,6 +406,12 @@ geom_cv 52.10922 + $`FALSE`$geom_mean_long + geom_mean mean_ci_lwr mean_ci_upr + 1.41421356 0.01729978 115.60839614 + attr(,"label") + [1] "Geometric Mean (95% CI)" + $`TRUE` $`TRUE`$n @@ -406,6 +460,12 @@ attr(,"label") [1] "Mean -/+ 1xSD" + $`TRUE`$mean_long + mean mean_ci_lwr mean_ci_upr + 2.50000 -16.55931 21.55931 + attr(,"label") + [1] "Mean (95% CI)" + $`TRUE`$mean_pval p_value 0.3440417 @@ -428,6 +488,12 @@ attr(,"label") [1] "Median 95% CI" + $`TRUE`$median_long + median median_ci_lwr median_ci_upr + 2.5 NA NA + attr(,"label") + [1] "Median (95% CI)" + $`TRUE`$quantiles quantile_0.25 quantile_0.75 1 4 @@ -474,6 +540,12 @@ geom_cv 127.0458 + $`TRUE`$geom_mean_long + geom_mean mean_ci_lwr mean_ci_upr + 2.000000e+00 2.992824e-04 1.336530e+04 + attr(,"label") + [1] "Geometric Mean (95% CI)" + # summarize_change works as expected diff --git a/tests/testthat/_snaps/utils_default_stats_formats_labels.md b/tests/testthat/_snaps/utils_default_stats_formats_labels.md index 774a14a31d..ea57d3c8a2 100644 --- a/tests/testthat/_snaps/utils_default_stats_formats_labels.md +++ b/tests/testthat/_snaps/utils_default_stats_formats_labels.md @@ -27,11 +27,13 @@ Code res Output - [1] "n" "sum" "mean" "sd" "se" - [6] "mean_sd" "mean_se" "mean_ci" "mean_sei" "mean_sdi" - [11] "mean_pval" "median" "mad" "median_ci" "quantiles" - [16] "iqr" "range" "min" "max" "median_range" - [21] "cv" "geom_mean" "geom_mean_ci" "geom_cv" + [1] "n" "sum" "mean" "sd" + [5] "se" "mean_sd" "mean_se" "mean_ci" + [9] "mean_sei" "mean_sdi" "mean_pval" "median" + [13] "mad" "median_ci" "quantiles" "iqr" + [17] "range" "min" "max" "median_range" + [21] "cv" "geom_mean" "geom_mean_ci" "geom_cv" + [25] "median_long" "mean_long" "geom_mean_long" # get_labels_from_stats works as expected @@ -82,22 +84,24 @@ Code res Output - n sum mean - "xx." "xx.x" "xx.x" - sd se mean_sd - "xx.x" "xx.x" "xx.x (xx.x)" - mean_se mean_ci mean_sei - "xx.x (xx.x)" "(xx.xx, xx.xx)" "(xx.xx, xx.xx)" - mean_sdi mean_pval median - "(xx.xx, xx.xx)" "x.xxxx | (<0.0001)" "xx.x" - mad median_ci quantiles - "xx.x" "(xx.xx, xx.xx)" "xx.x - xx.x" - iqr range min - "xx.x" "xx.x - xx.x" "xx.x" - max median_range cv - "xx.x" "xx.x (xx.x - xx.x)" "xx.x" - geom_mean geom_mean_ci geom_cv - "xx.x" "(xx.xx, xx.xx)" "xx.x" + n sum mean + "xx." "xx.x" "xx.x" + sd se mean_sd + "xx.x" "xx.x" "xx.x (xx.x)" + mean_se mean_ci mean_sei + "xx.x (xx.x)" "(xx.xx, xx.xx)" "(xx.xx, xx.xx)" + mean_sdi mean_pval median + "(xx.xx, xx.xx)" "x.xxxx | (<0.0001)" "xx.x" + mad median_ci quantiles + "xx.x" "(xx.xx, xx.xx)" "xx.x - xx.x" + iqr range min + "xx.x" "xx.x - xx.x" "xx.x" + max median_range cv + "xx.x" "xx.x (xx.x - xx.x)" "xx.x" + geom_mean geom_mean_ci geom_cv + "xx.x" "(xx.xx, xx.xx)" "xx.x" + median_long mean_long geom_mean_long + "xx.xx (xx.xx - xx.xx)" "xx.xx (xx.xx - xx.xx)" "xx.xx (xx.xx - xx.xx)" # summary_labels works as expected @@ -128,6 +132,10 @@ "CV (%)" "Geometric Mean" geom_mean_ci geom_cv "Geometric Mean 95% CI" "CV % Geometric Mean" + median_long mean_long + "Median (95% CI)" "Mean (95% CI)" + geom_mean_long + "Geometric Mean (95% CI)" --- diff --git a/tests/testthat/test-utils_rtables.R b/tests/testthat/test-utils_rtables.R index 3e482c9a39..fbeb9e337c 100644 --- a/tests/testthat/test-utils_rtables.R +++ b/tests/testthat/test-utils_rtables.R @@ -291,4 +291,5 @@ testthat::test_that("default na_str works properly", { analyze_vars(vars = "VAR", .stats = c("n", "mean")) %>% build_table(dt) testthat::expect_identical(matrix_form(tbl)$strings[-1, 2], c("0", "")) + set_default_na_str(NULL) })