Skip to content

Commit de52eb6

Browse files
authored
Merge pull request #414 from tidymodels/colnames
check x column names
2 parents 18004ab + 805faa3 commit de52eb6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

R/fit.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
#' @seealso [set_engine()], [control_parsnip()], `model_spec`, `model_fit`
8686
#' @param x A matrix, sparse matrix, or data frame of predictors. Only some
8787
#' models have support for sparse matrix input. See `parsnip::get_encoding()`
88-
#' for details.
88+
#' for details. `x` should have column names.
8989
#' @param y A vector, matrix or data frame of outcome data.
9090
#' @rdname fit
9191
#' @export
@@ -195,6 +195,9 @@ fit_xy.model_spec <-
195195
if (!identical(class(control), class(control_parsnip()))) {
196196
rlang::abort("The 'control' argument should have class 'control_parsnip'.")
197197
}
198+
if (is.null(colnames(x))) {
199+
rlang::abort("'x' should have column names.")
200+
}
198201
object <- check_mode(object, levels(y))
199202
dots <- quos(...)
200203
if (is.null(object$engine)) {

man/fit.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)