-
Notifications
You must be signed in to change notification settings - Fork 112
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
fixes string interpolation failure for splines #1381
Conversation
@@ -46,6 +46,14 @@ spline2_create <- function(x, nm = "pred", .fn = "bSpline", df = 3, complete_set | |||
|
|||
spline_msg <- function(x) { | |||
x <- as.character(x) | |||
# Error messages can contain brackets (e.g. "Error in if (df < 0) { : missing value") |
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.
A lot of comments so that future me/us will get the logic
# to change the delimiters but will ignore them if they are doubled. So we | ||
# change "{" to "{{" (and also for close). Simultaneous substitution via | ||
# `pattern = "(\\{)|(\\})"` produces poor results so we do them one at a time. | ||
x <- gsub("(\\{)", "\\1\\1", x) |
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.
Maybe this can be done in one shot?
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.
I'm perfectly fine to do it one at a time. we are throwing an error when this code is run so speed isn't an issue
@@ -1,6 +1,6 @@ | |||
Package: recipes | |||
Title: Preprocessing and Feature Engineering Steps for Modeling | |||
Version: 1.1.0.9000 |
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.
So that I can updates tests/skips in tune
@@ -46,6 +46,14 @@ spline2_create <- function(x, nm = "pred", .fn = "bSpline", df = 3, complete_set | |||
|
|||
spline_msg <- function(x) { |
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.
For next week: pass the upstream caller env to avoid "Caused by error in spline_msg()
:"
# to change the delimiters but will ignore them if they are doubled. So we | ||
# change "{" to "{{" (and also for close). Simultaneous substitution via | ||
# `pattern = "(\\{)|(\\})"` produces poor results so we do them one at a time. | ||
x <- gsub("(\\{)", "\\1\\1", x) |
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.
I'm perfectly fine to do it one at a time. we are throwing an error when this code is run so speed isn't an issue
looking good! |
* add type checking files * remove newly unneeded checking functions * snapshot updates from tidymodels/recipes#1381 * updates files * basic replacements * type checker replacements * tidymodels/tailor#53 * Update R/checks.R Co-authored-by: Simon P. Couch <[email protected]> * add remote to get proper error messages * typo * update remotes? * only test snapshots with more recent version of R *with* rankdeficient --------- Co-authored-by: Simon P. Couch <[email protected]>
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. |
Closes #1380
Created on 2024-10-18 with reprex v2.1.1