From 549194661f09c1a7e4c234f43678e08583ae2ba1 Mon Sep 17 00:00:00 2001 From: "Simon P. Couch" Date: Mon, 26 Feb 2024 10:48:41 -0600 Subject: [PATCH] address slowdown in `form_form()` (#1073) --- R/fit_helpers.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R/fit_helpers.R b/R/fit_helpers.R index bc97106d2..d8fcb7870 100644 --- a/R/fit_helpers.R +++ b/R/fit_helpers.R @@ -9,9 +9,12 @@ form_form <- if (inherits(env$data, "data.frame")) { check_outcome(eval_tidy(rlang::f_lhs(env$formula), env$data), object) + encoding_info <- get_encoding(class(object)[1]) encoding_info <- - get_encoding(class(object)[1]) %>% - dplyr::filter(mode == object$mode, engine == object$engine) + vctrs::vec_slice( + encoding_info, + encoding_info$mode == object$mode & encoding_info$engine == object$engine + ) remove_intercept <- encoding_info %>% dplyr::pull(remove_intercept) if (remove_intercept) {