Skip to content

Commit e0fae3d

Browse files
committed
checks pass, improve file naming
1 parent 4da3c9f commit e0fae3d

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export(smooth_arx_forecaster)
7070
export(step_epi_ahead)
7171
export(step_epi_lag)
7272
export(step_epi_naomit)
73+
export(step_epi_shift)
7374
export(validate_layer)
7475
import(recipes)
7576
importFrom(generics,augment)

R/epi_shift_internal.R renamed to R/step_epi_shift.R

+11-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#' specify an alternative filler value with the `default`
99
#' argument.
1010
#'
11+
#' `step_epi_shift` is more general, accomodating both leads and lags
12+
#' simultaneously.
13+
#'
1114
#' @param recipe A recipe object. The step will be added to the
1215
#' sequence of operations for this recipe.
1316
#' @param ... One or more selector functions to choose variables
@@ -16,7 +19,7 @@
1619
#' they be assigned?
1720
#' @param trained A logical to indicate if the quantities for
1821
#' 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
2023
#' be the lag or lead for each value in the vector. Lag integers must be
2124
#' nonnegative, while ahead integers must be positive.
2225
#' @param prefix A prefix to indicate what type of variable this is
@@ -32,6 +35,8 @@
3235
#' Care should be taken when using `skip = TRUE` as it may affect
3336
#' the computations for subsequent operations.
3437
#' @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.
3540
#' @template step-return
3641
#'
3742
#' @details The step assumes that the data are already _in the proper sequential
@@ -54,7 +59,8 @@
5459
#' r <- epi_recipe(case_death_rate_subset) %>%
5560
#' step_epi_ahead(death_rate, ahead = 7) %>%
5661
#' 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")
5864
#' r
5965
step_epi_lag <-
6066
function(recipe,
@@ -122,6 +128,9 @@ step_epi_ahead <-
122128
)
123129
}
124130

131+
#' @family row operation steps
132+
#' @rdname step_epi_shift
133+
#' @export
125134
step_epi_shift <-
126135
function(recipe,
127136
...,

man/step_epi_shift.Rd

+26-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)