Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: epiprocess
Title: Tools for basic signal processing in epidemiology
Version: 0.9.3
Version: 0.9.4
Authors@R: c(
person("Jacob", "Bien", role = "ctb"),
person("Logan", "Brooks", , "[email protected]", role = c("aut", "cre")),
Expand Down Expand Up @@ -35,7 +35,7 @@ Imports:
checkmate,
cli,
data.table,
dplyr (>= 1.0.8),
dplyr (>= 1.1.0),
genlasso,
ggplot2,
glue,
Expand All @@ -53,11 +53,11 @@ Imports:
vctrs,
waldo
Suggests:
covidcast,
devtools,
epidatr,
knitr,
outbreaks,
readr,
rmarkdown,
testthat (>= 3.1.5),
withr
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.x.y will indicat
syntax.
- Improved validation of `.window_size` arguments.

## Cleanup

- Removed vignette dependency on `covidcast`.

# epiprocess 0.9

## Breaking changes
Expand Down
13 changes: 9 additions & 4 deletions data-raw/jhu_csse_county_level_subset.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
library(readr)
library(epidatr)
library(covidcast)
library(epiprocess)
library(dplyr)

# Use covidcast::county_census to get the county and state names
y <- covidcast::county_census %>%
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(),
STNAME = col_character(),
CTYNAME = col_character()
)
) %>%
filter(STNAME %in% c("Massachusetts", "Vermont"), STNAME != CTYNAME) %>%
select(geo_value = FIPS, county_name = CTYNAME, state_name = STNAME)

Expand All @@ -18,7 +23,7 @@ jhu_csse_county_level_subset <- pub_covidcast(
time_values = epirange(20200601, 20211231),
) %>%
select(geo_value, time_value, cases = value) %>%
full_join(y, by = "geo_value") %>%
inner_join(y, by = "geo_value", relationship = "many-to-one", unmatched = c("error", "drop")) %>%
as_epi_df()

usethis::use_data(jhu_csse_county_level_subset, overwrite = TRUE)
31 changes: 19 additions & 12 deletions vignettes/aggregation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ kinds of tasks with `epi_df` objects. We'll work with county-level reported
COVID-19 cases in MA and VT.

```{r, message = FALSE, eval= FALSE, warning= FALSE}
library(readr)
library(epidatr)
library(covidcast)
library(epiprocess)
library(dplyr)

# Use covidcast::county_census to get the county and state names
y <- covidcast::county_census %>%
# Get mapping between FIPS codes and county&state names:
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 = c(
FIPS = col_character(),
CTYNAME = col_character(),
STNAME = col_character()
)
) %>%
filter(STNAME %in% c("Massachusetts", "Vermont"), STNAME != CTYNAME) %>%
select(geo_value = FIPS, county_name = CTYNAME, state_name = STNAME)

Expand All @@ -33,15 +39,15 @@ x <- pub_covidcast(
time_values = epirange(20200601, 20211231),
) %>%
select(geo_value, time_value, cases = value) %>%
full_join(y, by = "geo_value") %>%
inner_join(y, by = "geo_value", relationship = "many-to-one", unmatched = c("error", "drop")) %>%
as_epi_df(as_of = as.Date("2024-03-20"))
```

The data contains 16,212 rows and 5 columns.

```{r, echo=FALSE, warning=FALSE, message=FALSE}
library(readr)
library(epidatr)
library(covidcast)
library(epiprocess)
library(dplyr)

Expand Down Expand Up @@ -110,15 +116,16 @@ help avoid bugs in further downstream data processing tasks.
Let's first remove certain dates from our data set to create gaps:

```{r}
state_naming <- read_csv("https://github.com/cmu-delphi/covidcast/raw/c89e4d295550ba1540d64d2cc991badf63ad04e5/Python-packages/covidcast-py/covidcast/geo_mappings/state_census.csv", # nolint: line_length_linter
col_types = c(NAME = col_character(), ABBR = col_character())
) %>%
transmute(state_name = NAME, abbr = tolower(ABBR)) %>%
as_tibble()

# First make geo value more readable for tables, plots, etc.
x <- x %>%
mutate(
geo_value = paste(
substr(county_name, 1, nchar(county_name) - 7),
name_to_abbr(state_name),
sep = ", "
)
) %>%
inner_join(state_naming, by = "state_name", relationship = "many-to-one", unmatched = c("error", "drop")) %>%
mutate(geo_value = paste(substr(county_name, 1, nchar(county_name) - 7), state_name, sep = ", ")) %>%
select(geo_value, time_value, cases)

xt <- as_tsibble(x) %>% filter(cases >= 3)
Expand Down