Skip to content

Commit 7eaf0c9

Browse files
committed
fixed how outcomes are handled in model.frame and unquoted recipe args
1 parent 69ee298 commit 7eaf0c9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

R/fit.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,11 @@ formula_to_xy <- function(object, formula, data) {
177177

178178
# Q: avoid eval using ?get_expr(data[["data"]])
179179
x <- stats::model.frame(formula, eval_tidy(data[["data"]]))
180-
y <- model.response(x, "numeric")
180+
y <- model.response(x)
181+
outcome_cols <- attr(terms(x), "response")
182+
if (!isTRUE(all.equal(outcome_cols, 0))) {
183+
x <- x[,-outcome_cols, drop = FALSE]
184+
}
181185
eval_tidy(object$method$fit)
182186
}
183187

@@ -217,8 +221,6 @@ recipe_to_xy <- function(object, recipe, data) {
217221
y <- y[[1]]
218222

219223
fit_expr <- object$method$fit
220-
fit_expr$x <- quote(x)
221-
fit_expr$y <- quote(y)
222224
eval_tidy(fit_expr)
223225
}
224226

0 commit comments

Comments
 (0)