Skip to content

Commit

Permalink
don't namespace functions on step_dummy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilHvitfeldt committed May 30, 2024
1 parent 25b1820 commit 653f328
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions R/dummy.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ warn_new_levels <- function(dat, lvl, column, step, details = NULL) {
if (any(is.na(lvl2))) {
msg <- c(
msg,
"i" = "Consider using {.fn recipes::step_unknown} before \\
{.fn {step}} to handle missing values."
"i" = "Consider using {.help [step_unknown()](recipes::step_unknown)} \\
before {.fn {step}} to handle missing values."
)
}
if (!all(is.na(lvl2))) {
msg <- c(
msg,
"i" = "Consider using {.fn recipes::step_novel} before \\
{.fn {step}} to handle unseen values."
"i" = "Consider using {.help [step_novel()](recipes::step_novel)} \\
before {.fn {step}} to handle unseen values."
)
}
msg <- c(msg, details)
Expand Down
14 changes: 7 additions & 7 deletions tests/testthat/_snaps/dummy.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Condition
Warning:
! There are new levels in `city`: NA.
i Consider using `recipes::step_unknown()` before `step_dummy()` to handle missing values.
i Consider using step_unknown() (`?recipes::step_unknown()`) before `step_dummy()` to handle missing values.

---

Expand All @@ -35,7 +35,7 @@
Condition
Warning:
! There are new levels in `city`: NA.
i Consider using `recipes::step_unknown()` before `step_dummy()` to handle missing values.
i Consider using step_unknown() (`?recipes::step_unknown()`) before `step_dummy()` to handle missing values.

# tests for NA values in ordered factor

Expand All @@ -44,7 +44,7 @@
Condition
Warning:
! There are new levels in `city`: NA.
i Consider using `recipes::step_unknown()` before `step_dummy()` to handle missing values.
i Consider using step_unknown() (`?recipes::step_unknown()`) before `step_dummy()` to handle missing values.

---

Expand All @@ -53,7 +53,7 @@
Condition
Warning:
! There are new levels in `city`: NA.
i Consider using `recipes::step_unknown()` before `step_dummy()` to handle missing values.
i Consider using step_unknown() (`?recipes::step_unknown()`) before `step_dummy()` to handle missing values.

# new levels

Expand All @@ -63,7 +63,7 @@
Condition
Warning:
! There are new levels in `column`: C.
i Consider using `recipes::step_novel()` before `step_dummy()` to handle unseen values.
i Consider using step_novel() (`?recipes::step_novel()`) \ before `step_dummy()` to handle unseen values.

---

Expand All @@ -72,7 +72,7 @@
Condition
Warning:
! There are new levels in `x1`: C.
i Consider using `recipes::step_novel()` before `step_dummy()` to handle unseen values.
i Consider using step_novel() (`?recipes::step_novel()`) \ before `step_dummy()` to handle unseen values.
Output
# A tibble: 10 x 2
y x1_B
Expand All @@ -95,7 +95,7 @@
Condition
Warning:
! There are new levels in `a`: NA.
i Consider using `recipes::step_unknown()` before `step_dummy()` to handle missing values.
i Consider using step_unknown() (`?recipes::step_unknown()`) before `step_dummy()` to handle missing values.

# Deprecation warning

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/unknown.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
Condition
Warning:
! There are new levels in `city`: "WEST_SACRAMENTO".
i Consider using `recipes::step_novel()` before `step_unknown()` to handle unseen values.
i Consider using step_novel() (`?recipes::step_novel()`) \ before `step_unknown()` to handle unseen values.
* New levels will be coerced to `NA` by `step_unknown()`.
Warning:
! There are new levels in `zip`: "z95691".
i Consider using `recipes::step_novel()` before `step_unknown()` to handle unseen values.
i Consider using step_novel() (`?recipes::step_novel()`) \ before `step_unknown()` to handle unseen values.
* New levels will be coerced to `NA` by `step_unknown()`.

# bad args
Expand Down

0 comments on commit 653f328

Please sign in to comment.