We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5dd6fec + 57d3ca5 commit 78a51acCopy full SHA for 78a51ac
R/predict.R
@@ -244,8 +244,8 @@ prepare_data <- function(object, new_data) {
244
get_encoding(class(object$spec)[1]) %>%
245
dplyr::filter(mode == object$spec$mode, engine == object$spec$engine) %>%
246
dplyr::pull(remove_intercept)
247
- if (remove_intercept) {
248
- new_data <- new_data[, colnames(new_data) != "(Intercept)", drop = FALSE]
+ if (remove_intercept & any(grepl("Intercept", names(new_data)))) {
+ new_data <- new_data %>% dplyr::select(-dplyr::one_of("(Intercept)"))
249
}
250
251
switch(
0 commit comments