Skip to content
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

link to info on model formulas in error message #1257

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Suggests:
kernlab,
knitr,
modeldata (>= 0.1.1),
parsnip (>= 0.1.7),
parsnip (>= 1.1.1.9001),
RANN,
RcppRoll,
rmarkdown,
Expand All @@ -72,3 +72,5 @@ Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Remotes:
tidymodels/parsnip
8 changes: 5 additions & 3 deletions R/recipe.R
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,11 @@ inline_check <- function(x) {
cli::cli_abort(c(
x = "No in-line functions should be used here.",
i = "{cli::qty(length(funs))}The following function{?s} {?was/were} \\
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to not increase the number of i entries further, I opted to collapse the itemization onto the line where it's introduced. I believe this happens in a few other places in recipes already!

found:",
"*" = "{.and {.code {funs}}}",
i = "Use steps to do transformations instead."
found: {.and {.code {funs}}}.",
i = "Use steps to do transformations instead.",
i = "If your modeling engine uses special terms in formulas, pass \\
that formula to workflows as a \\
{.help [model formula](parsnip::model_formula)}."
))
}

Expand Down
16 changes: 8 additions & 8 deletions man/recipe.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions man/selections.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions tests/testthat/_snaps/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
Condition
Error in `inline_check()`:
x No in-line functions should be used here.
i The following function was found:
* `log`
i The following function was found: `log`.
i Use steps to do transformations instead.
i If your modeling engine uses special terms in formulas, pass that formula to workflows as a model formula (`?parsnip::model_formula()`).

---

Expand All @@ -16,9 +16,9 @@
Condition
Error in `inline_check()`:
x No in-line functions should be used here.
i The following functions were found:
* `^` and `(`
i The following functions were found: `^` and `(`.
i Use steps to do transformations instead.
i If your modeling engine uses special terms in formulas, pass that formula to workflows as a model formula (`?parsnip::model_formula()`).

---

Expand All @@ -27,9 +27,9 @@
Condition
Error in `inline_check()`:
x No in-line functions should be used here.
i The following function was found:
* `:`
i The following function was found: `:`.
i Use steps to do transformations instead.
i If your modeling engine uses special terms in formulas, pass that formula to workflows as a model formula (`?parsnip::model_formula()`).

---

Expand All @@ -38,9 +38,9 @@
Condition
Error in `inline_check()`:
x No in-line functions should be used here.
i The following function was found:
* `^`
i The following function was found: `^`.
i Use steps to do transformations instead.
i If your modeling engine uses special terms in formulas, pass that formula to workflows as a model formula (`?parsnip::model_formula()`).

# Using prepare

Expand Down