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

add better errors for misspelled arguments #1318

Merged
merged 4 commits into from
May 29, 2024

Conversation

EmilHvitfeldt
Copy link
Member

Longstanding issue, somehow without an issue. surprisingly easy to fix.

Before:

library(recipes)

recipe(mpg ~ ., data = mtcars) |> 
  step_normalize(all_predictors(), num_comps = 3) |>
  prep()
#> Error in `step_normalize()`:
#> Caused by error in `prep()`:
#> ! Can't rename variables in this context.

After:

library(recipes)

recipe(mpg ~ ., data = mtcars) |> 
  step_normalize(all_predictors(), num_comps = 3) |>
  prep()
#> Error in `step_normalize()`:
#> Caused by error in `prep()`:
#> ! The following argument was specified but not available: `num_comps`.

@EmilHvitfeldt EmilHvitfeldt requested a review from simonpcouch May 28, 2024 19:42
Copy link
Contributor

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

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

This is wonderful. :) I remember tripping up on helping someone with this error message in a workshop last year.

R/selections.R Outdated Show resolved Hide resolved
tests/testthat/test-basics.R Outdated Show resolved Hide resolved
@EmilHvitfeldt EmilHvitfeldt merged commit 512ffec into main May 29, 2024
9 checks passed
@EmilHvitfeldt EmilHvitfeldt deleted the missspelled-argument-error branch May 29, 2024 17:08
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants