Skip to content

Commit 57d3ca5

Browse files
committed
check for intercept before trying to remove
1 parent bb5e98e commit 57d3ca5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

R/predict.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ prepare_data <- function(object, new_data) {
244244
get_encoding(class(object$spec)[1]) %>%
245245
dplyr::filter(mode == object$spec$mode, engine == object$spec$engine) %>%
246246
dplyr::pull(remove_intercept)
247-
if (remove_intercept) {
247+
if (remove_intercept & any(grepl("Intercept", names(new_data)))) {
248248
new_data <- new_data %>% dplyr::select(-dplyr::one_of("(Intercept)"))
249249
}
250250

0 commit comments

Comments
 (0)