Skip to content

Km issue #22: unite #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# Generated by roxygen2: do not edit by hand

S3method(bake,step_epi_ahead)
S3method(bake,step_epi_lag)
S3method(epi_keys,default)
S3method(epi_keys,epi_df)
S3method(epi_keys,recipe)
S3method(epi_recipe,default)
S3method(epi_recipe,epi_df)
S3method(epi_recipe,formula)
S3method(prep,step_epi_ahead)
S3method(prep,step_epi_lag)
S3method(print,step_epi_ahead)
S3method(print,step_epi_lag)
export("%>%")
export(arx_args_list)
Expand All @@ -27,7 +24,6 @@ export(knnarx_args_list)
export(knnarx_forecaster)
export(smooth_arx_args_list)
export(smooth_arx_forecaster)
export(step_epi_ahead)
export(step_epi_lag)
import(recipes)
importFrom(magrittr,"%>%")
Expand Down
163 changes: 0 additions & 163 deletions R/epi_ahead.R

This file was deleted.

6 changes: 3 additions & 3 deletions R/epi_lag.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
#'
#' @family row operation steps
#' @export
#' @rdname step_epi_ahead
#' @rdname step_epi_lag
step_epi_lag <-
function(recipe,
...,
role = "predictor",
trained = FALSE,
lag = 1,
lag = 1, # negative for ahead
prefix = "lag_",
default = NA,
keys = epi_keys(recipe),
Expand Down Expand Up @@ -117,7 +117,7 @@ bake.step_epi_lag <- function(object, new_data, ...) {
print.step_epi_lag <-
function(x, width = max(20, options()$width - 30), ...) {
## TODO add printing of the lags
title <- "Lagging "
title <- ifelse(x$lag >= 0, "Lagging", "Leading")
recipes::print_step(x$columns, x$terms, x$trained, title, width)
invisible(x)
}
117 changes: 0 additions & 117 deletions man/step_epi_ahead.Rd

This file was deleted.

41 changes: 41 additions & 0 deletions man/step_epi_lag.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion musings/example-recipe.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ xx <- x %>% filter(time_value > "2021-12-01")
# Baseline AR3
r <- epi_recipe(x) %>% # if we add this as a class, maybe we get better
# behaviour downstream?
step_epi_ahead(death_rate, ahead = 7) %>%
step_epi_lag(death_rate, lag = -7) %>%
step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
step_epi_lag(case_rate, lag = c(0, 7, 14)) %>%
step_naomit(all_predictors()) %>%
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-assign_arg_list.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test_that("First argument must be a list",{
expect_error(assign_arg_list(c(1,2,3)))
})
test_that("All arguments should be named",{
expect_error(assign_arg_list(list(1,2)))
})
Loading