Skip to content

Commit c90b698

Browse files
committed
Merge branch 'internal-refactoring' of https://github.com/tidymodels/parsnip into internal-refactoring
2 parents 0ae5d36 + de7c048 commit c90b698

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

R/aaa_models.R

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,7 @@ check_fit_info <- function(fit_obj) {
206206
call. = FALSE)
207207
}
208208

209-
exp_interf <- c("data.frame", "formula", "matrix")
210-
if (length(fit_obj$interface) != 1) {
211-
stop("The `interface` element should have a single value of : ",
212-
paste0("`", exp_interf, "`", collapse = ", "),
213-
call. = FALSE)
214-
}
215-
if (!fit_obj$interface %in% exp_interf) {
216-
stop("The `interface` element should have a value of : ",
217-
paste0("`", exp_interf, "`", collapse = ", "),
218-
call. = FALSE)
219-
}
209+
check_interface_val(fit_obj$interface)
220210
check_func_val(fit_obj$func)
221211

222212
if (!is.list(fit_obj$defaults)) {
@@ -265,6 +255,17 @@ check_pkg_val <- function(pkg) {
265255
invisible(NULL)
266256
}
267257

258+
check_interface_val <- function(x) {
259+
exp_interf <- c("data.frame", "formula", "matrix")
260+
if (length(x) != 1 || !(x %in% exp_interf)) {
261+
stop("The `interface` element should have a single value of : ",
262+
paste0("`", exp_interf, "`", collapse = ", "),
263+
call. = FALSE)
264+
}
265+
invisible(NULL)
266+
}
267+
268+
268269
# ------------------------------------------------------------------------------
269270

270271
#' @rdname get_model_env

0 commit comments

Comments
 (0)