R/model-rpart.R

Defines functions orbital.rpart

#' @export
orbital.rpart <- function(
  x,
  ...,
  mode = c("classification", "regression"),
  type = NULL,
  lvl = NULL,
  .from_parsnip = FALSE
) {
  check_bare_fit(x, .from_parsnip)
  mode <- rlang::arg_match(mode)
  type <- default_type(type)

  if (mode == "classification") {
    res <- character()
    if ("class" %in% type) {
      eq <- tidypredict::tidypredict_fit(x)
      eq <- deparse1(eq, control = "digits17")
      res <- c(res, orbital_tmp_class_name = eq)
    }
    if ("prob" %in% type) {
      eqs <- deparse_eqs(tidypredict::tidypredict_class_exprs(x))
      names(eqs) <- paste0("orbital_tmp_prob_name", seq_along(lvl))
      res <- c(res, eqs)
    }
  } else if (mode == "regression") {
    res <- tidypredict::tidypredict_fit(x)
  }
  res
}

Try the orbital package in your browser

Any scripts or data that you put into this service are public.

orbital documentation built on Sept. 5, 2026, 1:07 a.m.