Skip to content

Commit 0c18e46

Browse files
committed
fixes the error behaviour
1 parent 91bd0b1 commit 0c18e46

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

R/step_epi_shift.R

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,22 @@ step_epi_lag <-
5555
...,
5656
role = "predictor",
5757
trained = FALSE,
58-
lag = 1,
58+
lag,
5959
prefix = "lag_",
6060
default = NA,
6161
columns = NULL,
6262
skip = FALSE,
6363
id = rand_id("epi_lag")) {
64+
if (missing(lag)) {
65+
rlang::abort(
66+
c("The `lag` argument must not be empty.",
67+
i = "Did you perhaps pass an integer in `...` accidentally?"))
68+
}
6469
arg_is_nonneg_int(lag)
6570
arg_is_chr_scalar(prefix, id)
71+
if (!is.null(columns))
72+
rlang::abort(c("The `columns` argument must be `NULL.",
73+
i = "Use `tidyselect` methods to choose columns to lag."))
6674
add_step(recipe,
6775
step_epi_lag_new(
6876
terms = dplyr::enquos(...),
@@ -88,14 +96,22 @@ step_epi_ahead <-
8896
...,
8997
role = "outcome",
9098
trained = FALSE,
91-
ahead = 1,
99+
ahead,
92100
prefix = "ahead_",
93101
default = NA,
94102
columns = NULL,
95103
skip = FALSE,
96104
id = rand_id("epi_ahead")) {
105+
if (missing(ahead)) {
106+
rlang::abort(
107+
c("The `ahead` argument must not be empty.",
108+
i = "Did you perhaps pass an integer in `...` accidentally?"))
109+
}
97110
arg_is_nonneg_int(ahead)
98111
arg_is_chr_scalar(prefix, id)
112+
if (!is.null(columns))
113+
rlang::abort(c("The `columns` argument must be `NULL.",
114+
i = "Use `tidyselect` methods to choose columns to lead."))
99115
add_step(recipe,
100116
step_epi_ahead_new(
101117
terms = dplyr::enquos(...),

man/step_epi_shift.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)