diff --git a/DESCRIPTION b/DESCRIPTION index def2039..7af5354 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -28,5 +28,5 @@ Remotes: cmu-delphi/epiprocess Encoding: UTF-8 LazyData: true -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 URL: https://cmu-delphi.github.io/epidatasets/ diff --git a/data-raw/archive_cases_dv_subset_dt.R b/data-raw/archive_cases_dv_subset_dt.R index 6f505c1..b56555a 100644 --- a/data-raw/archive_cases_dv_subset_dt.R +++ b/data-raw/archive_cases_dv_subset_dt.R @@ -1,14 +1,15 @@ -library(dplyr) library(epidatr) library(epiprocess) +library(data.table) +library(dplyr) dv_subset <- pub_covidcast( source = "doctor-visits", signals = "smoothed_adj_cli", - time_type = "day", geo_type = "state", - time_values = epirange(20200601, 20211201), + time_type = "day", geo_values = "ca,fl,ny,tx", + time_values = epirange(20200601, 20211201), issues = epirange(20200601, 20211201) ) %>% select(geo_value, time_value, version = issue, percent_cli = value) %>% @@ -19,16 +20,16 @@ dv_subset <- pub_covidcast( case_rate_subset <- pub_covidcast( source = "jhu-csse", signals = "confirmed_7dav_incidence_prop", - time_type = "day", geo_type = "state", - time_values = epirange(20200601, 20211201), + time_type = "day", geo_values = "ca,fl,ny,tx", + time_values = epirange(20200601, 20211201), issues = epirange(20200601, 20211201) ) %>% select(geo_value, time_value, version = issue, case_rate_7d_av = value) %>% as_epi_archive(compactify = FALSE) -archive_cases_dv_subset = epix_merge( +archive_cases_dv_subset <- epix_merge( dv_subset, case_rate_subset, sync = "locf", compactify = FALSE) @@ -39,4 +40,4 @@ archive_cases_dv_subset = epix_merge( # objects; store the DT and construct the R6 object on request. archive_cases_dv_subset_dt <- archive_cases_dv_subset$DT -usethis::use_data(archive_cases_dv_subset_dt, overwrite = TRUE) +usethis::use_data(archive_cases_dv_subset_dt, overwrite = TRUE, internal = TRUE) diff --git a/data-raw/cases_deaths_subset.R b/data-raw/cases_deaths_subset.R index 184a5c3..2f5ebb0 100644 --- a/data-raw/cases_deaths_subset.R +++ b/data-raw/cases_deaths_subset.R @@ -1,58 +1,61 @@ -library(dplyr) library(epidatr) library(epiprocess) +library(dplyr) -confirmed_7dav_incidence_prop <- pub_covidcast( +confirmed_incidence_num <- pub_covidcast( source = "jhu-csse", - signals = "confirmed_7dav_incidence_prop", - time_type = "day", + signals = "confirmed_incidence_num", geo_type = "state", + time_type = "day", + geo_values = "ca,fl,ny,tx,ga,pa", time_values = epirange(20200301, 20211231), - geo_values = "ca,fl,ny,tx,ga,pa" ) %>% - select(geo_value, time_value, case_rate_7d_av = value) %>% + select(geo_value, time_value, cases = value) %>% arrange(geo_value, time_value) -deaths_7dav_incidence_prop <- pub_covidcast( +confirmed_7dav_incidence_num <- pub_covidcast( source = "jhu-csse", - signals = "deaths_7dav_incidence_prop", - time_type = "day", + signals = "confirmed_7dav_incidence_num", geo_type = "state", + time_type = "day", + geo_values = "ca,fl,ny,tx,ga,pa", time_values = epirange(20200301, 20211231), - geo_values = "ca,fl,ny,tx,ga,pa" ) %>% - select(geo_value, time_value, death_rate_7d_av = value) %>% + select(geo_value, time_value, cases_7d_av = value) %>% arrange(geo_value, time_value) -confirmed_incidence_num <- pub_covidcast( +confirmed_7dav_incidence_prop <- pub_covidcast( source = "jhu-csse", - signals = "confirmed_incidence_num", - time_type = "day", + signals = "confirmed_7dav_incidence_prop", geo_type = "state", + time_type = "day", + geo_values = "ca,fl,ny,tx,ga,pa", time_values = epirange(20200301, 20211231), - geo_values = "ca,fl,ny,tx,ga,pa" ) %>% - select(geo_value, time_value, cases = value) %>% + select(geo_value, time_value, case_rate_7d_av = value) %>% arrange(geo_value, time_value) -confirmed_7dav_incidence_num <- pub_covidcast( +deaths_7dav_incidence_prop <- pub_covidcast( source = "jhu-csse", - signals = "confirmed_7dav_incidence_num", - time_type = "day", + signals = "deaths_7dav_incidence_prop", geo_type = "state", + time_type = "day", + geo_values = "ca,fl,ny,tx,ga,pa", time_values = epirange(20200301, 20211231), - geo_values = "ca,fl,ny,tx,ga,pa" ) %>% - select(geo_value, time_value, cases_7d_av = value) %>% + select(geo_value, time_value, death_rate_7d_av = value) %>% arrange(geo_value, time_value) -cases_deaths_subset <- confirmed_7dav_incidence_prop %>% - full_join(deaths_7dav_incidence_prop, - by = c("geo_value", "time_value")) %>% - full_join(confirmed_incidence_num, - by = c("geo_value", "time_value")) %>% +cases_deaths_subset <- confirmed_incidence_num %>% full_join(confirmed_7dav_incidence_num, - by = c("geo_value", "time_value")) %>% + by = c("geo_value", "time_value") + ) %>% + full_join(confirmed_7dav_incidence_prop, + by = c("geo_value", "time_value") + ) %>% + full_join(deaths_7dav_incidence_prop, + by = c("geo_value", "time_value") + ) %>% as_epi_df() usethis::use_data(cases_deaths_subset, overwrite = TRUE) diff --git a/data-raw/covid_incidence_county_subset.R b/data-raw/covid_incidence_county_subset.R index cc94485..d0b31ac 100644 --- a/data-raw/covid_incidence_county_subset.R +++ b/data-raw/covid_incidence_county_subset.R @@ -1,9 +1,9 @@ -# Use covidcast::county_census to get the county and state names -library(dplyr) -library(covidcast) library(epidatr) +library(covidcast) library(epiprocess) +library(dplyr) +# Use covidcast::county_census to get the county and state names y <- covidcast::county_census %>% filter(STNAME %in% c("Massachusetts", "Vermont"), STNAME != CTYNAME) %>% select(geo_value = FIPS, county_name = CTYNAME, state_name = STNAME) @@ -12,10 +12,10 @@ y <- covidcast::county_census %>% covid_incidence_county_subset <- pub_covidcast( source = "jhu-csse", signals = "confirmed_incidence_num", - time_type = "day", geo_type = "county", + time_type = "day", + geo_values = paste(y$geo_value, collapse = ","), time_values = epirange(20200601, 20211231), - geo_values = paste(y$geo_value, collapse = ",") ) %>% select(geo_value, time_value, cases = value) %>% full_join(y, by = "geo_value") %>% diff --git a/data-raw/covid_incidence_outliers.R b/data-raw/covid_incidence_outliers.R index a81bf8a..a08272d 100644 --- a/data-raw/covid_incidence_outliers.R +++ b/data-raw/covid_incidence_outliers.R @@ -1,14 +1,15 @@ -library(dplyr) library(epidatr) library(epiprocess) +library(dplyr) +library(tidyr) covid_incidence_outliers <- pub_covidcast( source = "jhu-csse", signals = "confirmed_incidence_num", - time_type = "day", geo_type = "state", - time_values = epirange(20200601, 20210531), + time_type = "day", geo_values = "fl,nj", + time_values = epirange(20200601, 20210531), as_of = 20211028 ) %>% select(geo_value, time_value, cases = value) %>% diff --git a/data/cases_deaths_subset.rda b/data/cases_deaths_subset.rda index dd5570e..281f496 100644 Binary files a/data/cases_deaths_subset.rda and b/data/cases_deaths_subset.rda differ