@@ -14,6 +14,9 @@ source("_common.R")
14
14
``` {r setup, message=FALSE}
15
15
library(epipredict)
16
16
library(recipes)
17
+ library(dplyr)
18
+ library(workflows)
19
+ library(parsnip)
17
20
```
18
21
19
22
In this vignette, we will state the main goal of the add/update/remove and
@@ -68,7 +71,7 @@ South Carolina.
68
71
69
72
``` {r}
70
73
jhu <- covid_case_death_rates %>%
71
- dplyr:: filter(time_value >= as.Date("2021-11-01"), geo_value %in% c("ak", "ca", "ny", "sc"))
74
+ filter(time_value >= as.Date("2021-11-01"), geo_value %in% c("ak", "ca", "ny", "sc"))
72
75
73
76
jhu
74
77
```
@@ -100,7 +103,7 @@ We may then go on to add the fitted linear model to our `epi_workflow`:
100
103
101
104
``` {r}
102
105
# Fit a linear model
103
- wf <- epi_workflow(r, parsnip:: linear_reg()) %>% fit(jhu)
106
+ wf <- epi_workflow(r, linear_reg()) %>% fit(jhu)
104
107
105
108
wf
106
109
```
@@ -139,7 +142,7 @@ using `workflows::remove_recipe()` and then inspect the class of `wf`:
139
142
140
143
``` {r}
141
144
wf %>% class() # class before
142
- workflows:: remove_recipe(wf) %>% class() # class after removing recipe using workflows function
145
+ remove_recipe(wf) %>% class() # class after removing recipe using workflows function
143
146
```
144
147
145
148
We can observe that ` wf ` is no longer an ` epi_workflow ` and a ` workflow ` . It has
@@ -167,7 +170,7 @@ fit as before:
167
170
168
171
``` {r}
169
172
# fit linear model
170
- wf <- Update_model(wf, parsnip:: linear_reg()) %>% fit(jhu)
173
+ wf <- Update_model(wf, linear_reg()) %>% fit(jhu)
171
174
wf
172
175
```
173
176
@@ -243,8 +246,8 @@ number in the order of operations, which can be obtained by inspecting `r2` or
243
246
the tidy summary of it:
244
247
245
248
``` {r}
246
- workflows:: extract_preprocessor(wf) # step_epi_ahead is the third step in r2
247
- tidy(workflows:: extract_preprocessor(wf)) # tidy tibble summary of r2
249
+ extract_preprocessor(wf) # step_epi_ahead is the third step in r2
250
+ tidy(extract_preprocessor(wf)) # tidy tibble summary of r2
248
251
249
252
wf <- wf %>% adjust_epi_recipe(which_step = 3, ahead = 14)
250
253
```
@@ -268,7 +271,7 @@ variable, we would specify the step number of 2 in `which_step`.
268
271
``` {r}
269
272
wf <- wf %>% adjust_epi_recipe(which_step = 2, lag = c(0, 1, 7, 14, 21))
270
273
271
- workflows:: extract_preprocessor(wf)
274
+ extract_preprocessor(wf)
272
275
```
273
276
274
277
We could adjust a recipe directly in the same way as we adjust a recipe in a
@@ -289,7 +292,7 @@ with a new `epi_recipe` that has undergone the adjustment
289
292
``` {r}
290
293
r2 <- adjust_epi_recipe(r2, which_step = 2, lag = 0:21)
291
294
292
- workflows:: extract_preprocessor(wf)
295
+ extract_preprocessor(wf)
293
296
```
294
297
295
298
## Adjust a single layer of a ` frosting `
0 commit comments