From e798cfb595cace1a51db574add4f8502d061e013 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 27 Nov 2023 18:07:24 +0100 Subject: [PATCH] lintr --- R/data_tabulate.R | 8 ++++---- R/to_numeric.R | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/data_tabulate.R b/R/data_tabulate.R index 98574d4a5..7a56e6a87 100644 --- a/R/data_tabulate.R +++ b/R/data_tabulate.R @@ -179,10 +179,10 @@ data_tabulate.grouped_df <- function(x, for (i in seq_along(grps)) { rows <- grps[[i]] # save information about grouping factors - if (!is.null(group_variables)) { - group_variable <- group_variables[i, , drop = FALSE] - } else { + if (is.null(group_variables)) { group_variable <- NULL + } else { + group_variable <- group_variables[i, , drop = FALSE] } out <- c(out, data_tabulate( data_filter(x, rows), @@ -226,7 +226,7 @@ format.dw_data_tabulate <- function(x, format = "text", big_mark = NULL, ...) { # format data frame ftab <- insight::format_table(x, ...) ftab[] <- lapply(ftab, function(i) { - i[i == ""] <- ifelse(identical(format, "text"), "", "(NA)") + i[i == ""] <- ifelse(identical(format, "text"), "", "(NA)") # nolint i }) ftab$N <- gsub("\\.00$", "", ftab$N) diff --git a/R/to_numeric.R b/R/to_numeric.R index 55bcbe319..9a35f9130 100644 --- a/R/to_numeric.R +++ b/R/to_numeric.R @@ -91,7 +91,7 @@ to_numeric.data.frame <- function(x, # drop numerics, when append is not FALSE select <- colnames(x[select])[!vapply(x[select], is.numeric, FUN.VALUE = logical(1L))] # process arguments - args <- .process_append( + fun_args <- .process_append( x, select, append, @@ -99,8 +99,8 @@ to_numeric.data.frame <- function(x, keep_factors = TRUE ) # update processed arguments - x <- args$x - select <- args$select + x <- fun_args$x + select <- fun_args$select } out <- sapply( @@ -129,7 +129,7 @@ to_numeric.data.frame <- function(x, } # due to the special handling of dummy factors, we need to take care - # of appending the data here again. usually, "args$x" includes the appended + # of appending the data here again. usually, "fun_args$x" includes the appended # data, which does not work here... if (!isFALSE(append)) {