Skip to content

Commit

Permalink
Prepare CRAN submission (#426)
Browse files Browse the repository at this point in the history
* Prepare CRAN submission

* update test

* prepare release
  • Loading branch information
strengejacke authored Dec 18, 2023
1 parent cc56753 commit 2de9c10
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: ggeffects
Type: Package
Encoding: UTF-8
Title: Create Tidy Data Frames of Marginal Effects for 'ggplot' from Model Outputs
Version: 1.3.3.2
Version: 1.3.4
Authors@R: c(
person("Daniel", "Lüdecke", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0002-8895-3206")),
person("Frederik", "Aust", role = "ctb", comment = c(ORCID = "0000-0003-4900-788X")),
Expand Down Expand Up @@ -95,4 +95,3 @@ VignetteBuilder: knitr
Config/testthat/edition: 3
Roxygen: list(markdown = TRUE)
License: MIT + file LICENSE
Remotes: rvlenth/emmeans
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Maintainance release.
Release to address reverse-dependency issues with the forthcoming update of 'emmeans', as requested by the CRAN team.
42 changes: 26 additions & 16 deletions tests/testthat/test-rq.R
Original file line number Diff line number Diff line change
@@ -1,29 +1,47 @@
skip_on_os(c("mac", "solaris"))
skip_if_not_installed("quantreg")
skip_if_not_installed("effects")
skip_if_not_installed("emmeans")

data(stackloss)
m1 <- quantreg::rq(stack.loss ~ Air.Flow + Water.Temp, data = stackloss, tau = 0.25)

test_that("ggpredict, rq", {
data(stackloss)
m1 <- quantreg::rq(stack.loss ~ Air.Flow + Water.Temp, data = stackloss, tau = 0.25)
expect_warning({
pr <- ggpredict(m1, "Air.Flow")
})
expect_equal(pr$predicted[1], 10.09524, tolerance = 1e-4)
})

test_that("ggeffect, rq", {
# ggeffect
expect_null(ggeffect(m1, "Air.Flow", verbose = FALSE))
})

test_that("ggemmeans, rq", {
# emmeans
skip_if_not_installed("emmeans", minimum_version = "1.9.0")
out <- ggemmeans(m1, "Air.Flow", verbose = FALSE)
expect_equal(out$predicted[1], 10.09524, tolerance = 1e-4)
expect_identical(dim(out), c(7L, 6L))
})


test_that("ggpredict, rqs, multiple taus", {
data(stackloss)
m2 <- quantreg::rq(
stack.loss ~ Air.Flow + Water.Temp,
data = stackloss,
tau = c(0.25, 0.5, 0.75)
)
out3 <- ggpredict(m2, "Air.Flow [50,55,60]")
expect_equal(
out3$conf.low,
c(
8.10594, 7.29479, 3.98695, 11.95882, 12.14723, 10.9099, 13.15987,
15.5423, 16.92013
),
tolerance = 1e-4
)
})


test_that("ggemmeans, rqs, multiple taus", {
skip_if_not_installed("emmeans", minimum_version = "1.9.0")
data(stackloss)
m2 <- quantreg::rq(
stack.loss ~ Air.Flow + Water.Temp,
Expand All @@ -40,12 +58,4 @@ test_that("ggemmeans, rqs, multiple taus", {
# validate against ggpredict
out3 <- ggpredict(m2, "Air.Flow [50,55,60]")
expect_equal(out$predicted, out3$predicted, tolerance = 1e-4)
expect_equal(
out3$conf.low,
c(
8.10594, 7.29479, 3.98695, 11.95882, 12.14723, 10.9099, 13.15987,
15.5423, 16.92013
),
tolerance = 1e-4
)
})

0 comments on commit 2de9c10

Please sign in to comment.