From d2a3e51453b986fab764edafe642ed3baa09ca89 Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 27 Jun 2024 09:40:11 +0200 Subject: [PATCH] lintr --- R/check_homogeneity.R | 6 +++--- R/check_multimodal.R | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/R/check_homogeneity.R b/R/check_homogeneity.R index db79fa106..76d73bc19 100644 --- a/R/check_homogeneity.R +++ b/R/check_homogeneity.R @@ -70,14 +70,14 @@ check_homogeneity.default <- function(x, method = c("bartlett", "fligner", "leve ) if (is.null(check)) { - insight::print_color("'check_homogeneity()' cannot perform check for normality. Please specify the 'method'-argument for the test of equal variances.\n", "red") + insight::print_color("'check_homogeneity()' cannot perform check for normality. Please specify the 'method'-argument for the test of equal variances.\n", "red") # nolint return(NULL) } method <- ifelse(check < 0.05, "fligner", "bartlett") } - if (method == "fligner") { + if (method == "fligner") { # nolint r <- stats::fligner.test(f, data = insight::get_data(x, verbose = FALSE)) p.val <- r$p.value } else if (method == "bartlett") { @@ -157,7 +157,7 @@ check_homogeneity.afex_aov <- function(x, method = "levene", ...) { if (any(is_covar)) { insight::format_alert( - "Levene's test is not appropriate with quantitative explanatory variables. Testing assumption of homogeneity among factor groups only." + "Levene's test is not appropriate with quantitative explanatory variables. Testing assumption of homogeneity among factor groups only." # nolint ) # ## TODO maybe add as option? # warning("Testing assumption of homogeneity on residualzied data among factor groups only.", call. = FALSE) diff --git a/R/check_multimodal.R b/R/check_multimodal.R index 55e70f78f..b48a5831e 100644 --- a/R/check_multimodal.R +++ b/R/check_multimodal.R @@ -58,10 +58,10 @@ check_multimodal.data.frame <- function(x, ...) { rez$p <- 1 - stats::pchisq(rez$Chisq, df = rez$df) # Text - text <- "The parametric mixture modelling test suggests that " + msg <- "The parametric mixture modelling test suggests that " if (rez$p < 0.05) { - text <- paste0( - text, + msg <- paste0( + msg, "the multivariate distribution is significantly multimodal (Chi2(", insight::format_value(rez$df, protect_integers = TRUE), ") = ", @@ -70,8 +70,8 @@ check_multimodal.data.frame <- function(x, ...) { ) color <- "green" } else { - text <- paste0( - text, + msg <- paste0( + msg, "the hypothesis of a multimodal multivariate distribution cannot be rejected (Chi2(", insight::format_value(rez$df, protect_integers = TRUE), ") = ", @@ -82,7 +82,7 @@ check_multimodal.data.frame <- function(x, ...) { } - attr(rez, "text") <- insight::format_message(text) + attr(rez, "text") <- insight::format_message(msg) attr(rez, "color") <- color attr(rez, "title") <- "Is the data multimodal?" class(rez) <- c("easystats_check", class(rez)) @@ -99,19 +99,19 @@ check_multimodal.numeric <- function(x, ...) { rez <- multimode::modetest(x, mod0 = 1, method = "ACR") rez <- list(p = rez$p.value, excess_mass = rez$statistic) - text <- "The Ameijeiras-Alonso et al. (2018) excess mass test suggests that " + msg <- "The Ameijeiras-Alonso et al. (2018) excess mass test suggests that " if (rez$p < 0.05) { - text <- paste0( - text, + msg <- paste0( + msg, "the distribution is significantly multimodal (excess mass = ", insight::format_value(rez$excess_mass), ", ", insight::format_p(rez$p), ").\n" ) color <- "green" } else { - text <- paste0( - text, + msg <- paste0( + msg, "the hypothesis of a multimodal distribution cannot be rejected (excess mass = ", insight::format_value(rez$excess_mass), ", ", insight::format_p(rez$p), ").\n" @@ -119,7 +119,7 @@ check_multimodal.numeric <- function(x, ...) { color <- "yellow" } - attr(rez, "text") <- insight::format_message(text) + attr(rez, "text") <- insight::format_message(msg) attr(rez, "color") <- color attr(rez, "title") <- "Is the variable multimodal?" class(rez) <- c("easystats_check", class(rez))