diff --git a/DESCRIPTION b/DESCRIPTION index 618f7a6a7..4c69d38aa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: marginaleffects Title: Predictions, Comparisons, Slopes, Marginal Means, and Hypothesis Tests -Version: 0.21.0.20 +Version: 0.21.0.21 Authors@R: c(person(given = "Vincent", family = "Arel-Bundock", diff --git a/NEWS.md b/NEWS.md index 5ae659baf..5e26b184d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,9 +2,10 @@ ## Development -Breaking change: +Breaking changes: * `type="invlink(link)"` is no longer default in `avg_predictions()` or when calling `predictions()` with the `by` argument. It is still default in `predictions()` without the `by` argument. The backtransform strategy is still available with by setting `type="invlink(link)"` explicitly. +* The `type` argument in `plot_comparisons()` now defaults to `NULL`, which is now consistent with `comparisons()` and `avg_comparisons()`. Before, the default was `type="response"`. Thanks to @giakhang1906 for report #1202. New: diff --git a/R/plot_comparisons.R b/R/plot_comparisons.R index e99be3d6c..8ce4e5086 100644 --- a/R/plot_comparisons.R +++ b/R/plot_comparisons.R @@ -38,7 +38,7 @@ plot_comparisons <- function(model, condition = NULL, by = NULL, newdata = NULL, - type = "response", + type = NULL, vcov = NULL, conf_level = 0.95, wts = FALSE, diff --git a/R/plot_slopes.R b/R/plot_slopes.R index 6c0907de7..78eb208a5 100644 --- a/R/plot_slopes.R +++ b/R/plot_slopes.R @@ -48,7 +48,7 @@ plot_slopes <- function(model, condition = NULL, by = NULL, newdata = NULL, - type = "response", + type = NULL, vcov = NULL, conf_level = 0.95, wts = FALSE, diff --git a/inst/tinytest/test-pkg-tidymodels.R b/inst/tinytest/test-pkg-tidymodels.R index 77c3a2bba..9f3fd4353 100644 --- a/inst/tinytest/test-pkg-tidymodels.R +++ b/inst/tinytest/test-pkg-tidymodels.R @@ -58,6 +58,26 @@ expect_inherits(m, "slopes") expect_false("std.error" %in% colnames(m)) +# Issue #1202 +fit <- linear_reg() |> + set_engine("lm") |> + fit(hp ~ am * vs, data = mtcars) +p <- plot_predictions(fit, condition = "am", draw = FALSE) +expect_inherits(p, "data.frame") + +p <- plot_comparisons(fit, + variables = "am", + condition = "vs", + draw = FALSE) +expect_inherits(p, "data.frame") + +p <- plot_comparisons(fit, + variables = "am", + condition = "vs", + draw = FALSE) +expect_inherits(p, "data.frame") + + rm(list = ls()) diff --git a/man/plot_comparisons.Rd b/man/plot_comparisons.Rd index 6e9a95550..8ca30f128 100644 --- a/man/plot_comparisons.Rd +++ b/man/plot_comparisons.Rd @@ -10,7 +10,7 @@ plot_comparisons( condition = NULL, by = NULL, newdata = NULL, - type = "response", + type = NULL, vcov = NULL, conf_level = 0.95, wts = FALSE, diff --git a/man/plot_slopes.Rd b/man/plot_slopes.Rd index a69c79d11..dff579e0a 100644 --- a/man/plot_slopes.Rd +++ b/man/plot_slopes.Rd @@ -10,7 +10,7 @@ plot_slopes( condition = NULL, by = NULL, newdata = NULL, - type = "response", + type = NULL, vcov = NULL, conf_level = 0.95, wts = FALSE,