You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/step_epi_shift.R
+30-5Lines changed: 30 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,10 @@
20
20
#' @param lag,ahead A vector of integers. Each specified column will
21
21
#' be the lag or lead for each value in the vector. Lag integers must be
22
22
#' nonnegative, while ahead integers must be positive.
23
+
#' @param latency_adjustment a character. Determines the method by which the forecast handles data that doesn't extend to the day the forecast is made. The options are:
24
+
#' - `"extend_ahead"`: actually forecasts from the last date. E.g. if there are 3 days of latency for a 4 day ahead forecast, the ahead used in practice is actually 7.
25
+
#' - `"locf"`: carries forward the last observed value up to the forecast date.
26
+
#' - `"extend_lags"`: per `epi_key` and `predictor`, adjusts the lag so that the shortest lag at predict time is
23
27
#' @param prefix A prefix to indicate what type of variable this is
24
28
#' @param default Determines what fills empty rows
25
29
#' left by leading/lagging (defaults to NA).
@@ -60,6 +64,12 @@ step_epi_lag <-
60
64
default=NA,
61
65
columns=NULL,
62
66
skip=FALSE,
67
+
latency_adjustment= c(
68
+
"None",
69
+
"extend_ahead",
70
+
"locf",
71
+
"extend_lags"
72
+
),
63
73
id= rand_id("epi_lag")) {
64
74
if (!is_epi_recipe(recipe)) {
65
75
rlang::abort("This recipe step can only operate on an `epi_recipe`.")
0 commit comments