|
8 | 8 | #' specify an alternative filler value with the `default`
|
9 | 9 | #' argument.
|
10 | 10 | #'
|
| 11 | +#' `step_epi_shift` is more general, accomodating both leads and lags |
| 12 | +#' simultaneously. |
| 13 | +#' |
11 | 14 | #' @param recipe A recipe object. The step will be added to the
|
12 | 15 | #' sequence of operations for this recipe.
|
13 | 16 | #' @param ... One or more selector functions to choose variables
|
|
16 | 19 | #' they be assigned?
|
17 | 20 | #' @param trained A logical to indicate if the quantities for
|
18 | 21 | #' preprocessing have been estimated.
|
19 |
| -#' @param lag,ahead A vector of integers. Each specified column will |
| 22 | +#' @param lag,ahead,shift A vector of integers. Each specified column will |
20 | 23 | #' be the lag or lead for each value in the vector. Lag integers must be
|
21 | 24 | #' nonnegative, while ahead integers must be positive.
|
22 | 25 | #' @param prefix A prefix to indicate what type of variable this is
|
|
32 | 35 | #' Care should be taken when using `skip = TRUE` as it may affect
|
33 | 36 | #' the computations for subsequent operations.
|
34 | 37 | #' @param id A unique identifier for the step
|
| 38 | +#' @param intended_direction used by `step_epi_shift` to determine whether |
| 39 | +#' leading or lagging was intended. |
35 | 40 | #' @template step-return
|
36 | 41 | #'
|
37 | 42 | #' @details The step assumes that the data are already _in the proper sequential
|
|
54 | 59 | #' r <- epi_recipe(case_death_rate_subset) %>%
|
55 | 60 | #' step_epi_ahead(death_rate, ahead = 7) %>%
|
56 | 61 | #' step_epi_lag(death_rate, case_rate, lag = c(0,7,14)) %>%
|
57 |
| -#' step_epi_shift(case_rate, shift = c(-5, 5)) # pretty odd, but possible |
| 62 | +#' # pretty odd, but possible |
| 63 | +#' step_epi_shift(case_rate, shift = c(-5, 5), role = "predictor") |
58 | 64 | #' r
|
59 | 65 | step_epi_lag <-
|
60 | 66 | function(recipe,
|
@@ -122,6 +128,9 @@ step_epi_ahead <-
|
122 | 128 | )
|
123 | 129 | }
|
124 | 130 |
|
| 131 | +#' @family row operation steps |
| 132 | +#' @rdname step_epi_shift |
| 133 | +#' @export |
125 | 134 | step_epi_shift <-
|
126 | 135 | function(recipe,
|
127 | 136 | ...,
|
|
0 commit comments