R/predict-fit.R

Defines functions tidypredict_fit.pm_xgb tidypredict_fit.pm_tree tidypredict_fit.pm_regression tidypredict_fit

Documented in tidypredict_fit

#' Returns a Tidy Eval formula to calculate fitted values
#'
#' It parses a model or uses an already parsed model to return a
#' Tidy Eval formula that can then be used inside a dplyr command.
#'
#' @param model An R model or a list with a parsed model.
#'
#' @examples
#'
#' model <- lm(mpg ~ wt + cyl * disp, offset = am, data = mtcars)
#' tidypredict_fit(model)
#' @export
tidypredict_fit <- function(model) {
  UseMethod("tidypredict_fit")
}

#' @export
tidypredict_fit.pm_regression <- function(model) {
  build_fit_formula(model)
}

#' @export
tidypredict_fit.pm_tree <- function(model) {
  build_fit_formula_rf(model)
}

#' @export
tidypredict_fit.pm_xgb <- function(model) {
  build_fit_formula_xgb(model)
}
edgararuiz/tidypredict documentation built on Oct. 2, 2021, 8:04 a.m.