Skip to content

Commit

Permalink
Check rev dep (#876)
Browse files Browse the repository at this point in the history
* version

* fix

* fix

* fix

* skip vignette on R < 4.4

* fix

* lintr
  • Loading branch information
strengejacke authored May 30, 2024
1 parent e3eb0c1 commit 24c23c4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: insight
Title: Easy Access to Model Information for Various Model Objects
Version: 0.19.11.4
Version: 0.19.11.5
Authors@R:
c(person(given = "Daniel",
family = "Lüdecke",
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-fixest.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
skip_if(TRUE)

skip_on_os("mac")
skip_if(getRversion() < "3.6.0")
skip_if_not_installed("fixest", minimum_version = "0.11.2")
Expand Down
6 changes: 4 additions & 2 deletions tests/testthat/test-lmer.R
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,10 @@ test_that("find_statistic", {
})

test_that("get_call", {
expect_s3_class(get_call(m1), "call")
expect_s3_class(get_call(m2), "call")
expect_true(inherits(get_call(m1), "call")) # nolint
expect_true(inherits(get_call(m2), "call")) # nolint
expect_type(get_call(m1), "language")
expect_type(get_call(m2), "language")
})

test_that("get_predicted_ci: warning when model matrix and varcovmat do not match", {
Expand Down
36 changes: 19 additions & 17 deletions tests/testthat/test-polr.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ test_that("link_inverse", {
})

test_that("get_data", {
expect_equal(nrow(get_data(m1)), 72)
expect_equal(
colnames(get_data(m1)),
expect_identical(nrow(get_data(m1)), 72L)
expect_named(
get_data(m1),
c("Sat", "Infl", "Type", "Cont", "Freq")
)
})
Expand Down Expand Up @@ -62,18 +62,18 @@ test_that("find_formula", {
})

test_that("find_terms", {
expect_equal(find_terms(m1), list(
expect_identical(find_terms(m1), list(
response = "Sat",
conditional = c("Infl", "Type", "Cont")
))
expect_equal(
expect_identical(
find_terms(m1, flatten = TRUE),
c("Sat", "Infl", "Type", "Cont")
)
})

test_that("n_obs", {
expect_equal(n_obs(m1), 1681)
expect_identical(n_obs(m1), 1681L)
})

test_that("linkfun", {
Expand All @@ -82,7 +82,7 @@ test_that("linkfun", {


test_that("find_parameters", {
expect_equal(
expect_identical(
find_parameters(m1),
list(
conditional =
Expand Down Expand Up @@ -126,7 +126,9 @@ test_that("get_parameters", {
),
stringsAsFactors = FALSE,
row.names = NULL
)
),
tolerance = 1e-5,
ignore_attr = TRUE
)
})

Expand All @@ -143,19 +145,19 @@ test_that("get_predicted", {
expect_s3_class(p2, "get_predicted")
expect_s3_class(p3, "get_predicted")
expect_s3_class(p4, "get_predicted")
expect_equal(p1, p3)
expect_equal(p2, p4)
expect_true(inherits(p1, "data.frame"))
expect_true(inherits(p2, "factor"))
expect_true(inherits(p3, "data.frame"))
expect_true(inherits(p4, "factor"))
expect_identical(p1, p3)
expect_identical(p2, p4)
expect_s3_class(p1, "data.frame")
expect_s3_class(p2, "factor")
expect_s3_class(p3, "data.frame")
expect_s3_class(p4, "factor")
expect_true(all(c("Row", "Response", "Predicted") %in% colnames(p1)))
expect_true(all(c("Row", "Response", "Predicted") %in% colnames(p3)))

d <- get_datagrid(m1, at = "Type", verbose = FALSE)
d <- get_datagrid(m1, by = "Type", verbose = FALSE)

p1 <- get_predicted(m1, predict = "expectation", data = d, verbose = FALSE)

expect_equal(colnames(p1), c("Row", "Type", "Response", "Predicted"))
expect_equal(dim(p1), c(12, 4))
expect_named(p1, c("Row", "Type", "Response", "Predicted"))
expect_identical(dim(p1), c(12L, 4L))
})
6 changes: 3 additions & 3 deletions vignettes/insight.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
if (!requireNamespace("lme4", quietly = TRUE)) {
if (!requireNamespace("lme4", quietly = TRUE) || getRversion() < "4.4.0") {
knitr::opts_chunk$set(eval = FALSE)
}
```
Expand Down Expand Up @@ -92,15 +92,15 @@ Here are some examples that demonstrate the differences of each function:
library(insight)
library(lme4)
data(sleepstudy)
sleepstudy$mygrp <- sample(1:5, size = 180, replace = TRUE)
sleepstudy$mygrp <- sample.int(5, size = 180, replace = TRUE)
sleepstudy$mysubgrp <- NA
sleepstudy$Weeks <- sleepstudy$Days / 7
sleepstudy$cat <- as.factor(sample(letters[1:4], nrow(sleepstudy), replace = TRUE))
for (i in 1:5) {
filter_group <- sleepstudy$mygrp == i
sleepstudy$mysubgrp[filter_group] <-
sample(1:30, size = sum(filter_group), replace = TRUE)
sample.int(30, size = sum(filter_group), replace = TRUE)
}
model <- suppressWarnings(lmer(
Expand Down

0 comments on commit 24c23c4

Please sign in to comment.