Skip to content

Commit

Permalink
Support class model_fit directly #1194
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Aug 22, 2024
1 parent 77a0c21 commit 23fcddc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/get_modeldata.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ get_modeldata <- function(model, additional_variables = FALSE, modeldata = NULL,
# some pre-processing, and we want to rely on the workflow to do that.
# workflows are triggered on `stats::predict()`
if (inherits(model, c("model_fit", "workflow"))) {
if ("fit" %in% names(model)) {
tmp <- try(get_modeldata(model$fit), silent = TRUE)
if (inherits(tmp, "data.frame")) {
return(tmp)
}
}
return(NULL)
}

Expand Down

0 comments on commit 23fcddc

Please sign in to comment.