From b42571da92aabcea6bdda23b6e33229b678bd591 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Fri, 6 Oct 2023 14:55:11 +0200 Subject: [PATCH] avoid loaded term --- R/data_match.R | 4 ++-- R/data_partition.R | 2 +- R/labels_to_levels.R | 2 +- R/means_by_group.R | 2 +- R/to_factor.R | 2 +- R/to_numeric.R | 2 +- R/utils.R | 2 +- R/utils_labels.R | 2 +- R/utils_standardize_center.R | 2 +- R/weighted_mean_median_sd_mad.R | 2 +- tests/testthat/test-data_partition.R | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/R/data_match.R b/R/data_match.R index 6b931c292..ff567d952 100644 --- a/R/data_match.R +++ b/R/data_match.R @@ -117,7 +117,7 @@ data_match <- function(x, to, match = "and", return_indices = FALSE, drop_na = T "or" ) - # sanity check + # validation check shared_columns <- intersect(colnames(x), colnames(to)) if (is.null(shared_columns) || length(shared_columns) == 0) { insight::format_error( @@ -207,7 +207,7 @@ data_filter.data.frame <- function(x, ...) { symbol <- dots[[i]] # evaluate, we may have a variable with filter expression eval_symbol <- .dynEval(symbol, ifnotfound = NULL) - # sanity check: is variable named like a function? + # validation check: is variable named like a function? if (is.function(eval_symbol)) { eval_symbol <- .dynGet(symbol, ifnotfound = NULL) } diff --git a/R/data_partition.R b/R/data_partition.R index ce4bc1d38..60eb57e35 100644 --- a/R/data_partition.R +++ b/R/data_partition.R @@ -52,7 +52,7 @@ data_partition <- function(data, verbose = TRUE, training_proportion = proportion, ...) { - # Sanity checks + # validation checks data <- .coerce_to_dataframe(data) if (sum(proportion) > 1) { diff --git a/R/labels_to_levels.R b/R/labels_to_levels.R index be1a8d8b7..ed63e0583 100644 --- a/R/labels_to_levels.R +++ b/R/labels_to_levels.R @@ -58,7 +58,7 @@ labels_to_levels.data.frame <- function(x, regex = FALSE, verbose = TRUE, ...) { - # sanity check, return as is for complete factor + # validation check, return as is for complete factor if (all(vapply(x, is.factor, TRUE))) { return(x) } diff --git a/R/means_by_group.R b/R/means_by_group.R index 1d3f6fd52..faa73eba6 100644 --- a/R/means_by_group.R +++ b/R/means_by_group.R @@ -60,7 +60,7 @@ means_by_group.numeric <- function(x, weights = NULL, digits = NULL, ...) { - # sanity check for arguments + # validation check for arguments # "group" must be provided if (is.null(group)) { diff --git a/R/to_factor.R b/R/to_factor.R index 82cabaaad..ece6290e4 100644 --- a/R/to_factor.R +++ b/R/to_factor.R @@ -89,7 +89,7 @@ to_factor.data.frame <- function(x, regex = FALSE, verbose = TRUE, ...) { - # sanity check, return as is for complete factor + # validation check, return as is for complete factor if (all(vapply(x, is.factor, FUN.VALUE = logical(1L)))) { return(x) } diff --git a/R/to_numeric.R b/R/to_numeric.R index 3d3f1c7a5..56001b039 100644 --- a/R/to_numeric.R +++ b/R/to_numeric.R @@ -69,7 +69,7 @@ to_numeric.data.frame <- function(x, regex = FALSE, verbose = TRUE, ...) { - # sanity check, return as is for complete numeric + # validation check, return as is for complete numeric if (all(vapply(x, is.numeric, FUN.VALUE = logical(1L)))) { return(x) } diff --git a/R/utils.R b/R/utils.R index 0f84466a9..663af028e 100644 --- a/R/utils.R +++ b/R/utils.R @@ -210,7 +210,7 @@ nchar_open <- nchar(open) nchar_close <- nchar(close) - # Sanity checks + # validation checks stopifnot(exprs = { is.character(fmt) length(fmt) == 1L diff --git a/R/utils_labels.R b/R/utils_labels.R index a7f4fa2c3..a783e4fda 100644 --- a/R/utils_labels.R +++ b/R/utils_labels.R @@ -30,7 +30,7 @@ # check positions of matching values and levels levels_in_labs <- stats::na.omit(match(value_labels, levels(x))) labs_in_levels <- stats::na.omit(match(levels(x), value_labels)) - # sanity check - if labelled values and levels don't match + # validation check - if labelled values and levels don't match if (!length(levels_in_labs) || !length(labs_in_levels)) { if (verbose) { insight::format_alert( diff --git a/R/utils_standardize_center.R b/R/utils_standardize_center.R index 0220fdd04..67c345d2e 100644 --- a/R/utils_standardize_center.R +++ b/R/utils_standardize_center.R @@ -30,7 +30,7 @@ vals <- x[valid_x] } - # Sanity checks + # validation checks check <- .check_standardize_numeric(x, name = NULL, verbose = verbose, reference = reference, center = center) if (is.factor(vals) || is.character(vals)) { diff --git a/R/weighted_mean_median_sd_mad.R b/R/weighted_mean_median_sd_mad.R index 86f685307..8965e8006 100644 --- a/R/weighted_mean_median_sd_mad.R +++ b/R/weighted_mean_median_sd_mad.R @@ -49,7 +49,7 @@ weighted_median <- function(x, weights = NULL, remove_na = TRUE, verbose = TRUE, weights <- complete$weights[order] rw <- cumsum(weights) / sum(weights) - # sanity check + # validation check if (all(is.na(rw))) { return(NA_real_) } diff --git a/tests/testthat/test-data_partition.R b/tests/testthat/test-data_partition.R index f9119f046..7443465a8 100644 --- a/tests/testthat/test-data_partition.R +++ b/tests/testthat/test-data_partition.R @@ -10,7 +10,7 @@ test_that("data_partition works as expected", { expect_snapshot(data_partition(letters, seed = 123)) - # sanity checks + # validation checks expect_warning( data_partition(iris, 0.7, row_id = "Species"),