Skip to content

Commit b8c557e

Browse files
committed
use new epidatr::pub_covidcast fn
data_source arg changed to source
1 parent 89829c4 commit b8c557e

9 files changed

+31
-47
lines changed

data-raw/archive_cases_dv_subset_dt.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,29 @@ library(dplyr)
22
library(epidatr)
33
library(epiprocess)
44

5-
dv_subset <- covidcast(
6-
data_source = "doctor-visits",
5+
dv_subset <- pub_covidcast(
6+
source = "doctor-visits",
77
signals = "smoothed_adj_cli",
88
time_type = "day",
99
geo_type = "state",
1010
time_values = epirange(20200601, 20211201),
1111
geo_values = "ca,fl,ny,tx",
1212
issues = epirange(20200601, 20211201)
1313
) %>%
14-
fetch() %>%
1514
select(geo_value, time_value, version = issue, percent_cli = value) %>%
1615
# We're using compactify=FALSE here and below to avoid some testthat test
1716
# failures on tests that were based on a non-compactified version.
1817
as_epi_archive(compactify = FALSE)
1918

20-
case_rate_subset <- covidcast(
21-
data_source = "jhu-csse",
19+
case_rate_subset <- pub_covidcast(
20+
source = "jhu-csse",
2221
signals = "confirmed_7dav_incidence_prop",
2322
time_type = "day",
2423
geo_type = "state",
2524
time_values = epirange(20200601, 20211201),
2625
geo_values = "ca,fl,ny,tx",
2726
issues = epirange(20200601, 20211201)
2827
) %>%
29-
fetch() %>%
3028
select(geo_value, time_value, version = issue, case_rate_7d_av = value) %>%
3129
as_epi_archive(compactify = FALSE)
3230

data-raw/cases_deaths_subset.R

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,47 @@ library(dplyr)
22
library(epidatr)
33
library(epiprocess)
44

5-
confirmed_7dav_incidence_prop <- covidcast(
6-
data_source = "jhu-csse",
5+
confirmed_7dav_incidence_prop <- pub_covidcast(
6+
source = "jhu-csse",
77
signals = "confirmed_7dav_incidence_prop",
88
time_type = "day",
99
geo_type = "state",
1010
time_values = epirange(20200301, 20211231),
1111
geo_values = "ca,fl,ny,tx,ga,pa"
1212
) %>%
13-
fetch() %>%
1413
select(geo_value, time_value, case_rate_7d_av = value) %>%
1514
arrange(geo_value, time_value)
1615

17-
deaths_7dav_incidence_prop <- covidcast(
18-
data_source = "jhu-csse",
16+
deaths_7dav_incidence_prop <- pub_covidcast(
17+
source = "jhu-csse",
1918
signals = "deaths_7dav_incidence_prop",
2019
time_type = "day",
2120
geo_type = "state",
2221
time_values = epirange(20200301, 20211231),
2322
geo_values = "ca,fl,ny,tx,ga,pa"
2423
) %>%
25-
fetch() %>%
2624
select(geo_value, time_value, death_rate_7d_av = value) %>%
2725
arrange(geo_value, time_value)
2826

29-
confirmed_incidence_num <- covidcast(
30-
data_source = "jhu-csse",
27+
confirmed_incidence_num <- pub_covidcast(
28+
source = "jhu-csse",
3129
signals = "confirmed_incidence_num",
3230
time_type = "day",
3331
geo_type = "state",
3432
time_values = epirange(20200301, 20211231),
3533
geo_values = "ca,fl,ny,tx,ga,pa"
3634
) %>%
37-
fetch() %>%
3835
select(geo_value, time_value, cases = value) %>%
3936
arrange(geo_value, time_value)
4037

41-
confirmed_7dav_incidence_num <- covidcast(
42-
data_source = "jhu-csse",
38+
confirmed_7dav_incidence_num <- pub_covidcast(
39+
source = "jhu-csse",
4340
signals = "confirmed_7dav_incidence_num",
4441
time_type = "day",
4542
geo_type = "state",
4643
time_values = epirange(20200301, 20211231),
4744
geo_values = "ca,fl,ny,tx,ga,pa"
4845
) %>%
49-
fetch() %>%
5046
select(geo_value, time_value, cases_7d_av = value) %>%
5147
arrange(geo_value, time_value)
5248

data-raw/counts_subset.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,22 @@ library(dplyr)
44
library(epidatr)
55
library(epiprocess)
66

7-
x <- covidcast(
8-
data_source = "jhu-csse",
7+
x <- pub_covidcast(
8+
source = "jhu-csse",
99
signals = "confirmed_incidence_num",
1010
time_type = "day",
1111
geo_type = "state",
1212
time_values = epirange(20210604, 20211231),
1313
geo_values = "ca,fl,tx,ny,nj") %>%
14-
fetch() %>%
1514
select(geo_value, time_value, cases = value)
1615

17-
y <- covidcast(
18-
data_source = "jhu-csse",
16+
y <- pub_covidcast(
17+
source = "jhu-csse",
1918
signals = "deaths_incidence_num",
2019
time_type = "day",
2120
geo_type = "state",
2221
time_values = epirange(20210604, 20211231),
2322
geo_values = "ca,fl,tx,ny,nj") %>%
24-
fetch() %>%
2523
select(geo_value, time_value, deaths = value)
2624

2725
counts_subset <- full_join(x, y, by = c("geo_value", "time_value")) %>%

data-raw/covid_case_death_rates.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@ library(dplyr)
22
library(epidatr)
33
library(epiprocess)
44

5-
x <- covidcast(
6-
data_source = "jhu-csse",
5+
x <- pub_covidcast(
6+
source = "jhu-csse",
77
signals = "confirmed_7dav_incidence_prop",
88
time_type = "day",
99
geo_type = "state",
1010
time_values = epirange(20200301, 20211231),
1111
geo_values = "*"
1212
) %>%
13-
fetch() %>%
1413
select(geo_value, time_value, case_rate = value)
1514

16-
y <- covidcast(
17-
data_source = "jhu-csse",
15+
y <- pub_covidcast(
16+
source = "jhu-csse",
1817
signals = "deaths_7dav_incidence_prop",
1918
time_type = "day",
2019
geo_type = "state",
2120
time_values = epirange(20200301, 20211231),
2221
geo_values = "*"
2322
) %>%
24-
fetch() %>%
2523
select(geo_value, time_value, death_rate = value)
2624

2725
covid_case_death_rates <- x %>%

data-raw/covid_incidence_county_subset.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ y <- covidcast::county_census %>%
99
select(geo_value = FIPS, county_name = CTYNAME, state_name = STNAME)
1010

1111
# Fetch only counties from Massachusetts and Vermont, then append names columns as well
12-
covid_incidence_county_subset <- covidcast(
13-
data_source = "jhu-csse",
12+
covid_incidence_county_subset <- pub_covidcast(
13+
source = "jhu-csse",
1414
signals = "confirmed_incidence_num",
1515
time_type = "day",
1616
geo_type = "county",
1717
time_values = epirange(20200601, 20211231),
1818
geo_values = paste(y$geo_value, collapse = ",")
1919
) %>%
20-
fetch() %>%
2120
select(geo_value, time_value, cases = value) %>%
2221
full_join(y, by = "geo_value") %>%
2322
as_epi_df()

data-raw/covid_incidence_outliers.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@ library(dplyr)
22
library(epidatr)
33
library(epiprocess)
44

5-
covid_incidence_outliers <- covidcast(
6-
data_source = "jhu-csse",
5+
covid_incidence_outliers <- pub_covidcast(
6+
source = "jhu-csse",
77
signals = "confirmed_incidence_num",
88
time_type = "day",
99
geo_type = "state",
1010
time_values = epirange(20200601, 20210531),
1111
geo_values = "fl,nj",
1212
as_of = 20211028
1313
) %>%
14-
fetch() %>%
1514
select(geo_value, time_value, cases = value) %>%
1615
as_epi_df()
1716

data-raw/ctis_covid_behaviours.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@
33
library(dplyr)
44
library(epidatr)
55

6-
behav_ind_mask <- covidcast(
7-
data_source = "fb-survey",
6+
behav_ind_mask <- pub_covidcast(
7+
source = "fb-survey",
88
signals = "smoothed_wwearing_mask_7d",
99
time_type = "day",
1010
geo_type = "state",
1111
time_values = epirange(20210604, 20211231),
1212
geo_values = "ca,fl,tx,ny,nj") %>%
13-
fetch() %>%
1413
select(geo_value, time_value, masking = value)
1514

16-
behav_ind_distancing <- covidcast(
17-
data_source = "fb-survey",
15+
behav_ind_distancing <- pub_covidcast(
16+
source = "fb-survey",
1817
signals = "smoothed_wothers_distanced_public",
1918
time_type = "day",
2019
geo_type = "state",
2120
time_values = epirange(20210604, 20211231),
2221
geo_values = "ca,fl,tx,ny,nj") %>%
23-
fetch() %>%
2422
select(geo_value, time_value, distancing = value)
2523

2624
ctis_covid_behaviours <- behav_ind_mask %>%
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
library(dplyr)
22
library(epidatr)
33

4-
jhu_confirmed_cumulative_num <- covidcast(
5-
data_source = "jhu-csse",
4+
jhu_confirmed_cumulative_num <- pub_covidcast(
5+
source = "jhu-csse",
66
signals = "confirmed_cumulative_num",
77
time_type = "day",
88
geo_type = "state",
99
time_values = epirange(20200301, 20220131),
1010
geo_values = "ca,fl,ny,tx"
11-
) %>% fetch()
12-
11+
)
1312

1413
usethis::use_data(jhu_confirmed_cumulative_num, overwrite = TRUE)

data-raw/state_census.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ state_census <- covidcast::state_census %>%
77
mutate(abbr = tolower(abbr)) %>%
88
as_tibble()
99

10-
1110
usethis::use_data(state_census, overwrite = TRUE)

0 commit comments

Comments
 (0)