Skip to content

Commit 722815e

Browse files
committed
Put some work into it.
1 parent 0233cd5 commit 722815e

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

R/step_naomit2.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#' Special NA omit step that does two steps in one
2+
#'
3+
#' @param x Recipe to be used.
4+
#'
5+
#' @return A recipe with NA's omitted ....
6+
#' @export recipes
7+
8+
step_naomit2 <- function(x) {
9+
x %>%
10+
recipes::step_naomit(all_predictors()) %>%
11+
recipes::step_naomit(all_outcomes(), skip = TRUE)
12+
}

musings/example-recipe.R

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ r <- epi_recipe(x) %>% # if we add this as a class, maybe we get better
4040
step_epi_ahead(death_rate, ahead = 7) %>%
4141
step_epi_lag(death_rate, lag = c(0, 7, 14)) %>%
4242
step_epi_lag(case_rate, lag = c(0, 7, 14)) %>%
43-
step_naomit(all_predictors()) %>%
44-
# below, `skip` means we don't do this at predict time
45-
# we should probably do something useful here to avoid user error
46-
step_naomit(all_outcomes(), skip = TRUE)
43+
step_narm()
4744

4845

4946
slm <- linear_reg()

0 commit comments

Comments
 (0)