Skip to content

Commit 3001b69

Browse files
committed
Updated test as to not use covidcast and delphi.epidata.
1 parent eb9771c commit 3001b69

File tree

2 files changed

+7
-30
lines changed

2 files changed

+7
-30
lines changed

musings/example-recipe.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ library(covidcast)
33
library(delphi.epidata)
44
library(epiprocess)
55
library(tidymodels)
6+
67
x <- covidcast(
78
data_source = "jhu-csse",
89
signals = "confirmed_7dav_incidence_prop",

tests/testthat/test-epi_shift_internal.R

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,14 @@
11
library(dplyr)
2-
library(covidcast)
3-
library(delphi.epidata)
42
library(epiprocess)
53
library(tidymodels)
64

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) %>%
3211
as_epi_df()
33-
rm(y)
34-
35-
xx <- x %>% filter(time_value > "2021-12-01")
3612

3713
slm_fit <- function(recipe, data = x) {
3814
workflow() %>%

0 commit comments

Comments
 (0)