From 788c44bb62a21799add639a17786a861fe695839 Mon Sep 17 00:00:00 2001 From: Dmitry Shemetov Date: Fri, 7 Feb 2025 18:26:52 -0800 Subject: [PATCH] deps: remove covidcast dependency * use covidcast state_census.csv directly rather than package --- .Rbuildignore | 2 ++ DESCRIPTION | 5 ++--- data-raw/covid_incidence_county_subset_tbl.R | 4 +++- data-raw/state_census.R | 5 ++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index b02316b..1aa78c6 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,5 @@ +^renv$ +^renv\.lock$ ^.*\.Rproj$ ^\.Rproj\.user$ ^data-raw$ diff --git a/DESCRIPTION b/DESCRIPTION index 967d158..58be995 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: epidatasets Title: Epidemiological Data for Delphi Tooling Examples -Version: 0.0.2 +Version: 0.0.3 Authors@R: c( person(c("Daniel", "J."), "McDonald", , "daniel@stat.ubc.ca", role = "aut"), person("Nat", "DeFries", , "ndefries@andrew.cmu.edu", role = c("cre", "aut")), @@ -27,8 +27,7 @@ URL: https://github.com/cmu-delphi/epidatasets, https://cmu-delphi.github.io/epidatasets/ Depends: R (>= 2.10) -Suggests: - covidcast, +Suggests: data.table, dplyr, epidatr, diff --git a/data-raw/covid_incidence_county_subset_tbl.R b/data-raw/covid_incidence_county_subset_tbl.R index 5e52be0..78143ae 100644 --- a/data-raw/covid_incidence_county_subset_tbl.R +++ b/data-raw/covid_incidence_county_subset_tbl.R @@ -5,7 +5,9 @@ source(here::here("data-raw/_helper.R")) d <- as.Date("2024-03-20") -# Previously, we were using `covidcast::county_census`, but covidcast is large and complicated to install (due to `sf` dependency). Instead, read the file directly from GitHub. +# Previously, we were using `covidcast::county_census`, but covidcast is large +# and complicated to install (due to `sf` dependency). Instead, read the file +# directly from GitHub. y <- read_csv("https://github.com/cmu-delphi/covidcast/raw/c89e4d295550ba1540d64d2cc991badf63ad04e5/Python-packages/covidcast-py/covidcast/geo_mappings/county_census.csv", # nolint: line_length_linter col_types = cols( FIPS = col_character(), diff --git a/data-raw/state_census.R b/data-raw/state_census.R index aeed08c..b3823cb 100644 --- a/data-raw/state_census.R +++ b/data-raw/state_census.R @@ -1,7 +1,10 @@ library(dplyr) library(covidcast) -state_census <- covidcast::state_census %>% +# Previously, we were using `covidcast::county_census`, but covidcast is large +# and complicated to install (due to `sf` dependency). Instead, read the file +# directly from GitHub. +state_census <- read_csv("https://github.com/cmu-delphi/covidcast/raw/c89e4d295550ba1540d64d2cc991badf63ad04e5/Python-packages/covidcast-py/covidcast/geo_mappings/state_census.csv") %>% # nolint: line_length_linter select(STATE, NAME, POPESTIMATE2019, ABBR) %>% rename(abbr = ABBR, name = NAME, pop = POPESTIMATE2019, fips = STATE) %>% # Left-pad FIPS codes with zeroes to 2 digits, and convert to character