@@ -265,9 +265,11 @@ data_tabulate.default <- function(
265265
266266 # validate "metrics"
267267 if (! is.null(metrics )) {
268- metrics <- match.arg(metrics ,
269- choices = c(" N" , " raw" , " valid" , " cumulative" ),
270- several.ok = TRUE )
268+ metrics <- match.arg(
269+ metrics ,
270+ choices = c(" N" , " raw" , " valid" , " cumulative" ),
271+ several.ok = TRUE
272+ )
271273 }
272274 if (" raw" %in% metrics ) {
273275 out $ `Raw %` <- 100 * out $ N / sum(out $ N )
@@ -302,7 +304,7 @@ data_tabulate.default <- function(
302304 }
303305 out <- cbind(var_info , out )
304306 }
305- total_n = sum(out $ N , na.rm = TRUE )
307+ total_n <- sum(out $ N , na.rm = TRUE )
306308 if (! " N" %in% metrics ) {
307309 out <- data_select(out , exclude = " N" )
308310 }
@@ -869,7 +871,7 @@ format.datawizard_table <- function(x, format = "text", big_mark = NULL, ...) {
869871 # convert to character manually, else, for large numbers,
870872 # format_table() returns scientific notation
871873 x <- as.data.frame(x )
872- if (! is.null(x $ N )){
874+ if (! is.null(x $ N )) {
873875 x $ N <- as.character(x $ N )
874876 }
875877 # format data frame
@@ -878,8 +880,8 @@ format.datawizard_table <- function(x, format = "text", big_mark = NULL, ...) {
878880 i [i == " " ] <- ifelse(identical(format , " text" ), " <NA>" , " (NA)" ) # nolint
879881 i
880882 })
881- if (! is.null(ftab $ N )){
882- ftab $ N <- gsub(" \\ .00$" , " " , ftab $ N )
883+ if (! is.null(ftab $ N )) {
884+ ftab $ N <- gsub(" \\ .00$" , " " , ftab $ N )
883885
884886 # insert big marks?
885887 ftab $ N <- .add_commas_in_numbers(ftab $ N , big_mark )
0 commit comments