From 4649b4d763d0ad2b4781d8a4652f40f823677759 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 10 Sep 2023 20:25:32 +0200 Subject: [PATCH 1/2] fix URL --- R/check_collinearity.R | 2 +- man/check_collinearity.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/check_collinearity.R b/R/check_collinearity.R index d1c5e0f22..19901cd5b 100644 --- a/R/check_collinearity.R +++ b/R/check_collinearity.R @@ -104,7 +104,7 @@ #' examples in R and Stan. 2nd edition. Chapman and Hall/CRC. #' #' - Vanhove, J. (2019). Collinearity isn't a disease that needs curing. -#' [webpage](https://janhove.github.io/analysis/2019/09/11/collinearity) +#' [webpage](https://janhove.github.io/posts/2019-09-11-collinearity/) #' #' - Zuur AF, Ieno EN, Elphick CS. A protocol for data exploration to avoid #' common statistical problems: Data exploration. Methods in Ecology and diff --git a/man/check_collinearity.Rd b/man/check_collinearity.Rd index 7a32f2221..9b943758d 100644 --- a/man/check_collinearity.Rd +++ b/man/check_collinearity.Rd @@ -153,7 +153,7 @@ Methods. Educational and Psychological Measurement, 79(5), 874–882. \item McElreath, R. (2020). Statistical rethinking: A Bayesian course with examples in R and Stan. 2nd edition. Chapman and Hall/CRC. \item Vanhove, J. (2019). Collinearity isn't a disease that needs curing. -\href{https://janhove.github.io/analysis/2019/09/11/collinearity}{webpage} +\href{https://janhove.github.io/posts/2019-09-11-collinearity/}{webpage} \item Zuur AF, Ieno EN, Elphick CS. A protocol for data exploration to avoid common statistical problems: Data exploration. Methods in Ecology and Evolution (2010) 1:3–14. From 0a620b96a507854bb313aa4b772bc65843c93c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Th=C3=A9riault?= <13123390+rempsyc@users.noreply.github.com> Date: Sun, 10 Sep 2023 14:25:50 -0400 Subject: [PATCH 2/2] Fix `check_outliers` ics which test on R devel (#608) --- tests/testthat/test-check_outliers.R | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/testthat/test-check_outliers.R b/tests/testthat/test-check_outliers.R index 2f7df555d..e464028d0 100644 --- a/tests/testthat/test-check_outliers.R +++ b/tests/testthat/test-check_outliers.R @@ -1,7 +1,3 @@ -skip_if_not_installed("bigutilsr") -skip_if_not_installed("ICS") -skip_if_not_installed("dbscan") - test_that("zscore negative threshold", { expect_error( check_outliers(mtcars$mpg, method = "zscore", threshold = -1), @@ -80,16 +76,15 @@ test_that("mahalanobis which", { }) test_that("mahalanobis_robust which", { + skip_if_not_installed("bigutilsr") expect_identical( which(check_outliers(mtcars, method = "mahalanobis_robust", threshold = 25)), as.integer(c(7, 9, 21, 24, 27, 28, 29, 31)) ) }) -## FIXME: Fails on CRAN/windows -# (should be fixed but not clear why method mcd needs a seed; -# there should not be an element of randomness to it I think) test_that("mcd which", { + # (not clear why method mcd needs a seed) set.seed(42) expect_identical( tail(which(check_outliers(mtcars[1:4], method = "mcd", threshold = 45))), @@ -98,13 +93,12 @@ test_that("mcd which", { }) ## FIXME: Fails on CRAN/windows -# (current CRAN version rstan is not compatible with R > 4.2) test_that("ics which", { # suddenly fails on R Under development (unstable) (2023-09-07 r85102) # gcc-13 (Debian 13.2.0-2) 13.2.0 - skip_on_os("linux") - skip_if_not_installed("rstan", minimum_version = "2.26.0") - set.seed(42) + skip_on_cran() + skip_if_not_installed("ICS") + skip_if_not_installed("ICSOutlier") expect_identical( which(check_outliers(mtcars, method = "ics", threshold = 0.001)), as.integer(c(9, 29)) @@ -112,6 +106,7 @@ test_that("ics which", { }) test_that("optics which", { + skip_if_not_installed("dbscan") expect_identical( which(check_outliers(mtcars, method = "optics", threshold = 14)), as.integer(c(5, 7, 15, 16, 17, 24, 25, 29, 31)) @@ -119,6 +114,7 @@ test_that("optics which", { }) test_that("lof which", { + skip_if_not_installed("dbscan") expect_identical( which(check_outliers(mtcars, method = "lof", threshold = 0.005)), 31L @@ -193,6 +189,7 @@ test_that("multiple methods which", { # We exclude method ics because it is too slow test_that("all methods which", { + skip_if_not_installed("bigutilsr") expect_identical( which(check_outliers(mtcars, method = c( @@ -214,6 +211,7 @@ test_that("all methods which", { test_that("multiple methods with ID", { + skip_if_not_installed("bigutilsr") data <- datawizard::rownames_as_column(mtcars, var = "car") x <- attributes(check_outliers(data, method = c( @@ -261,6 +259,7 @@ test_that("cook which", { # }) test_that("cook multiple methods which", { + skip_if_not_installed("dbscan") model <- lm(disp ~ mpg + hp, data = mtcars) expect_identical( which(check_outliers(model, method = c("cook", "optics", "lof"))), @@ -269,6 +268,7 @@ test_that("cook multiple methods which", { }) test_that("pareto which", { + skip_if_not_installed("dbscan") skip_if_not_installed("rstanarm") set.seed(123) model <- rstanarm::stan_glm(mpg ~ qsec + wt, data = mtcars, refresh = 0) @@ -281,6 +281,7 @@ test_that("pareto which", { }) test_that("pareto multiple methods which", { + skip_if_not_installed("dbscan") skip_if_not_installed("rstanarm") set.seed(123) model <- rstanarm::stan_glm(mpg ~ qsec + wt, data = mtcars, refresh = 0) @@ -310,7 +311,6 @@ test_that("BayesFactor which", { # 7. Next, we test grouped output test_that("cook multiple methods which", { - skip_if_not_installed("datawizard") iris2 <- datawizard::data_group(iris, "Species") z <- attributes(check_outliers(iris2, method = c("zscore", "iqr"))) expect_named(