R/compat-vctrs.R

Defines functions stop_never_called stop_incompatible_cast_rset

# Mimicking rsample `compat-vctrs.R`
# https://github.com/tidymodels/rsample/blob/master/R/compat-vctrs.R

# ------------------------------------------------------------------------------

stop_incompatible_cast_rset <- function(x, to, ..., x_arg, to_arg) {
  details <- "Can't cast to an rset because attributes are likely incompatible."
  vctrs::stop_incompatible_cast(x, to, x_arg = x_arg, to_arg = to_arg, details = details)
}

stop_never_called <- function(fn) {
  rlang::abort(paste0("Internal error: `", fn, "()` should never be called."))
}
tidymodels/spatialsample documentation built on Oct. 13, 2024, 3:35 p.m.