Skip to content

Commit

Permalink
tidymodels bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Oct 16, 2023
1 parent e8788aa commit 1417e43
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: marginaleffects
Title: Predictions, Comparisons, Slopes, Marginal Means, and Hypothesis Tests
Version: 0.15.1.9014
Version: 0.15.1.9015
Authors@R:
c(person(given = "Vincent",
family = "Arel-Bundock",
Expand Down
3 changes: 2 additions & 1 deletion R/methods_tidymodels.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ get_predict.model_fit <- function(model, newdata, type = NULL, ...) {
out <- stats::predict(model, new_data = newdata, type = type)

if (type == "numeric") {
out <- data.frame(rowid = seq_along(out), estimate = out[[".pred"]])
v <- intersect(c(".pred", ".pred_res"), colnames(out))[1]
out <- data.frame(rowid = seq_along(out), estimate = out[[v]])

} else if (type == "class") {
out <- data.frame(rowid = seq_along(out), estimate = out[[".pred_class"]])
Expand Down
1 change: 0 additions & 1 deletion inst/tinytest/test-pkg-tidymodels.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ p <- predictions(mod, newdata = bikes, type = "numeric") |>
expect_inherits(p, "predictions")
expect_true("std.error" %in% colnames(p))

exit_file("test this")
mfx <- avg_slopes(mod, newdata = bikes, type = "numeric") |>
suppressWarnings()
expect_inherits(mfx, "marginaleffects")
Expand Down

0 comments on commit 1417e43

Please sign in to comment.