Skip to content

Commit

Permalink
lintr
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Apr 3, 2024
1 parent 44ea2b9 commit e8bb2f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions R/check_homogeneity.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ print.check_homogeneity <- function(x, ...) {
} else if (x < 0.05) {
insight::print_color(sprintf("Warning: Variances differ between groups (%s, p = %.3f).\n", method.string, x), "red")
} else {
insight::print_color(sprintf("OK: There is not clear evidence for different variances across groups (%s, p = %.3f).\n", method.string, x), "green")
insight::print_color(sprintf("OK: There is not clear evidence for different variances across groups (%s, p = %.3f).\n", method.string, x), "green") # nolint
}
invisible(x)
}
Expand Down Expand Up @@ -146,13 +146,13 @@ check_homogeneity.afex_aov <- function(x, method = "levene", ...) {
insight::format_error("Levene test is only aplicable to ANOVAs with between-subjects factors.")
}

data <- x$data$long # Use this to also get id column
long_data <- x$data$long # Use this to also get id column
dv <- attr(x, "dv")
id <- attr(x, "id")
between <- names(attr(x, "between"))
is_covar <- vapply(attr(x, "between"), is.null, logical(1))

ag_data <- stats::aggregate(data[, dv], data[, c(between, id)], mean)
ag_data <- stats::aggregate(long_data[, dv], long_data[, c(between, id)], mean)
colnames(ag_data)[length(c(between, id)) + 1] <- dv

if (any(is_covar)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-check_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ test_that("`check_model()` no warnings for quasipoisson", {
mock_data <- data.frame(x, y, z) |>
# both should be whole numbers since they're counts
datawizard::data_modify(y = round(y), z = round(z)) |>
datawizard::data_filter(!x < 0, !y < 0)
datawizard::data_filter(x >= 0, y >= 0)
# Run model
model1 <- glm(y ~ x + offset(log(z)), family = "quasipoisson", data = mock_data)
expect_message(check_model(model1, verbose = TRUE), regex = "Not enough")
Expand Down

0 comments on commit e8bb2f9

Please sign in to comment.