-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make recipe() works with long formulas #1283
Conversation
Some of these CI failure also appear on dev branch |
#Conflicts: # tests/testthat/test-basics.R
predictor_names <- names(attr(data_info, "dataClasses")) | ||
if (length(response_info) > 0 && all(response_info > 0)) { | ||
predictor_names <- predictor_names[-response_info] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are allowed to do this refactor because get_rhs_vars()
is only ever called after inline_check()
in form2args()
https://github.com/tidymodels/recipes/blob/main/R/recipe.R#L233-L241
the the question in essence because:
- if formula contains a
.
, use "all names" otherwise useall.names()
to pull them out. - pull names out of lhs
- take the diff if needed
}) | ||
|
||
test_that("recipe() can handle very long formulas (#1283)", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test is simply here to demonstrate that we doesn't get a Error: C stack usage 7954280 is too close to the limit
error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, that's a lot of columns. Hell yeah!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so nice! Leaving review as "Comment" rather than "Approve" just so I can revisit and make sure I understand the situations where this is applied.
}) | ||
|
||
test_that("recipe() can handle very long formulas (#1283)", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, that's a lot of columns. Hell yeah!
Co-authored-by: Simon P. Couch <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex https://reprex.tidyverse.org) and link to this issue. |
I learned about
all.names()
a couple of days ago. And it works wonders in recipes!to close #1279
The previous issues we had with long formulas was that
fun_calls()
was recursive, and it just couldn't handle that large formulas. People were seeing issues with as low as 200 columns.Created on 2024-05-23 with reprex v2.1.0