Skip to content

Commit

Permalink
lintr
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Jun 27, 2024
1 parent de5d338 commit d2a3e51
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions R/check_homogeneity.R
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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)
Expand Down
24 changes: 12 additions & 12 deletions R/check_multimodal.R
Original file line number Diff line number Diff line change
Expand Up @@ -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),
") = ",
Expand All @@ -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),
") = ",
Expand All @@ -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))
Expand All @@ -99,27 +99,27 @@ 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"
)
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))
Expand Down

0 comments on commit d2a3e51

Please sign in to comment.