diff --git a/R/analyze_variables.R b/R/analyze_variables.R index c0eb2644de..d6fc459caa 100644 --- a/R/analyze_variables.R +++ b/R/analyze_variables.R @@ -620,7 +620,7 @@ a_summary <- function(x, .indent_mods <- get_indents_from_stats(.stats, .indent_mods) # Check for custom labels from control_analyze_vars - if (is.character(x) || is.factor(x)){ + if (is.character(x) || is.factor(x)) { levels_per_stats <- lapply(x_stats, names) } else { levels_per_stats <- NULL diff --git a/tests/testthat/test-analyze_variables.R b/tests/testthat/test-analyze_variables.R index ee9299e70e..45357dba9a 100644 --- a/tests/testthat/test-analyze_variables.R +++ b/tests/testthat/test-analyze_variables.R @@ -592,7 +592,8 @@ testthat::test_that("analyze_vars works well with additional stat names (.stat_n .stats = c("n", "mean", "count_fraction", "a_zero" = function(x, ...) { return(0) - }), + } + ), .stat_names_in = list("n" = "CoUnT", "v" = "something"), .formats = c("mean" = "auto", "v" = "xx.xx"), .labels = list("n" = "N=", "a" = "AAAA", "a_zero" = "A_ZERO"), @@ -615,4 +616,3 @@ testthat::test_that("analyze_vars works well with additional stat names (.stat_n c("VAR2", "a_zero", "A_ZERO", NA, 0) ) }) -