|
1 | 1 | library(dplyr) |
2 | | -library(covidcast) |
3 | | -library(delphi.epidata) |
4 | 2 | library(epiprocess) |
5 | 3 | library(tidymodels) |
6 | 4 |
|
7 | | -# Taken from example-recipe |
8 | | -x <- covidcast( |
9 | | - data_source = "jhu-csse", |
10 | | - signals = "confirmed_7dav_incidence_prop", |
11 | | - time_type = "day", |
12 | | - geo_type = "state", |
13 | | - time_values = epirange(20200301, 20211231), |
14 | | - geo_values = "*" |
15 | | -) %>% |
16 | | - fetch_tbl() %>% |
17 | | - select(geo_value, time_value, case_rate = value) |
18 | | - |
19 | | -y <- covidcast( |
20 | | - data_source = "jhu-csse", |
21 | | - signals = "deaths_7dav_incidence_prop", |
22 | | - time_type = "day", |
23 | | - geo_type = "state", |
24 | | - time_values = epirange(20200301, 20211231), |
25 | | - geo_values = "*" |
26 | | -) %>% |
27 | | - fetch_tbl() %>% |
28 | | - select(geo_value, time_value, death_rate = value) |
29 | | - |
30 | | -x <- x %>% |
31 | | - full_join(y, by = c("geo_value", "time_value")) %>% |
| 5 | +# Random generated dataset |
| 6 | +set.seed(100) |
| 7 | +x <- tibble(geo_value = rep("nowhere",200), |
| 8 | + time_value = as.Date("2021-01-01") + 0:199, |
| 9 | + case_rate = rpois(100,20) + 1:200, |
| 10 | + death_rate = rpois(100,10) + 1:200) %>% |
32 | 11 | as_epi_df() |
33 | | -rm(y) |
34 | | - |
35 | | -xx <- x %>% filter(time_value > "2021-12-01") |
36 | 12 |
|
37 | 13 | slm_fit <- function(recipe, data = x) { |
38 | 14 | workflow() %>% |
|
0 commit comments