diff --git a/DESCRIPTION b/DESCRIPTION index ee5e566c..f859d0bb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -28,7 +28,6 @@ Imports: lifecycle, stats Suggests: - aods3, covr, hms, ggplot2, diff --git a/cran-comments.md b/cran-comments.md index e3e81155..45279411 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -20,6 +20,16 @@ New maintainer: Nicole Hill Old maintainer(s): Joe Thorley + +## CRAN Issues + +Fixed the following error by conditionally skipping tests that rely on packages listed in suggests, if those packages are not installed. +After review, also decided to remove the dependency to the 'aods3' package. + +══ Failed tests ════════════════════════════════════════════════════════════════ +── Error ('test-log-lik.R:184:3'): beta_binom log_lik ────────────────────────── + +Error in `loadNamespace(x)`: there is no package called 'aods3' ## revdepcheck results diff --git a/tests/testthat/_snaps/log-lik.md b/tests/testthat/_snaps/log-lik.md new file mode 100644 index 00000000..88cd5c62 --- /dev/null +++ b/tests/testthat/_snaps/log-lik.md @@ -0,0 +1,21 @@ +# beta_binom log_lik + + Code + log_lik_beta_binom(x = samples, size = 50, prob = 0.2, theta = 1.1) + Output + [1] -4.976366 -2.395701 -1.375050 -3.917547 -1.375050 -4.314925 -4.409988 + [8] -3.218659 -4.045703 -1.375050 -4.409988 -1.375050 -3.685783 -1.375050 + [15] -1.375050 -2.395701 -1.375050 -1.375050 -4.845012 -1.375050 -2.395701 + [22] -4.631547 -2.787926 -1.375050 -1.375050 -1.375050 -3.983622 -3.769878 + [29] -1.375050 -1.375050 -1.375050 -3.769878 -3.035763 -3.769878 -3.364624 + [36] -3.486792 -5.021646 -1.375050 -2.395701 -1.375050 -1.375050 -1.375050 + [43] -3.218659 -1.375050 -3.592380 -4.045703 -1.375050 -1.375050 -1.375050 + [50] -2.787926 -5.269883 -4.976366 -2.395701 -1.375050 -5.326411 -1.375050 + [57] -1.375050 -4.716959 -1.375050 -3.218659 -1.375050 -3.685783 -5.521217 + [64] -1.375050 -1.375050 -1.375050 -3.486792 -3.364624 -1.375050 -2.395701 + [71] -1.375050 -4.265252 -1.375050 -2.395701 -1.375050 -2.395701 -3.592380 + [78] -3.486792 -1.375050 -3.769878 -2.395701 -4.045703 -1.375050 -3.035763 + [85] -2.395701 -3.218659 -1.375050 -2.787926 -1.375050 -3.035763 -1.375050 + [92] -1.375050 -1.375050 -1.375050 -4.265252 -1.375050 -2.395701 -3.364624 + [99] -3.035763 -1.375050 + diff --git a/tests/testthat/test-dev.R b/tests/testthat/test-dev.R index 062c4d71..8ba1cae1 100644 --- a/tests/testthat/test-dev.R +++ b/tests/testthat/test-dev.R @@ -242,6 +242,7 @@ test_that("gamma_pois log_lik", { }) test_that("gamma_pois deviance", { + skip_if_not_installed("MASS") samples <- ran_gamma_pois(10000, 3, 0.5) mod <- MASS::glm.nb(samples ~ 1) deviance <- sum(dev_gamma_pois(samples, exp(coef(mod)[1]), theta = 1 / mod$theta)) diff --git a/tests/testthat/test-log-lik.R b/tests/testthat/test-log-lik.R index 824bc6f6..ed4303b5 100644 --- a/tests/testthat/test-log-lik.R +++ b/tests/testthat/test-log-lik.R @@ -178,21 +178,18 @@ test_that("beta_binom vectorized", { }) test_that("beta_binom log_lik", { - samples2 <- ran_beta_binom(100, size = 50, prob = 0.1, theta = 1) - data <- data.frame( - samples2 = samples2, - mod_prob2 = 50 - samples2 + withr::with_seed( + 101, + samples <- ran_beta_binom(100, size = 50, prob = 0.1, theta = 1) ) - mod2 <- aods3::aodml(cbind(samples2, mod_prob2) ~ 1, - data = data, - family = "bb", method = "Nelder-Mead" + expect_snapshot( + log_lik_beta_binom( + x = samples, + size = 50, + prob = 0.2, + theta = 1.1 + ) ) - est_prob <- ilogit(mod2$b) - est_theta <- 2 / (1 / mod2$phi - 1) - expect_equal(mod2$logL, sum(log_lik_beta_binom(samples2, - size = 50, - prob = est_prob, theta = est_theta - ))) }) test_that("skewnorm missing values", { diff --git a/tests/testthat/test-numericise.R b/tests/testthat/test-numericise.R index 7f1a482c..88f0ea80 100644 --- a/tests/testthat/test-numericise.R +++ b/tests/testthat/test-numericise.R @@ -92,6 +92,7 @@ test_that("numericise.data.frame", { }) test_that("numericise.hms", { + skip_if_not_installed("hms") x <- structure(10.9, class = c("hms", "difftime"), units = "secs") expect_identical(numericise(x), 10.9) })