Skip to content

Commit

Permalink
Re-export editing pass + don't re-export cumulative death data
Browse files Browse the repository at this point in the history
Cumulative death data is in tibble format and isn't really the type of data we
expect in many functions. Probably not good to make it too accessible.
  • Loading branch information
brookslogan committed Oct 3, 2024
1 parent cbab352 commit 888bb57
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 114 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ export(growth_rate)
export(guess_period)
export(is_epi_df)
export(is_grouped_epi_archive)
export(jhu_confirmed_cumulative_num)
export(key_colnames)
export(max_version_with_row_in)
export(mutate)
Expand Down
20 changes: 0 additions & 20 deletions R/reexports.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,6 @@ delayedAssign("covid_incidence_county_subset", epidatasets::covid_incidence_coun
#' @export
delayedAssign("covid_incidence_outliers", epidatasets::covid_incidence_outliers)

#' @inherit epidatasets::jhu_confirmed_cumulative_num description source references title
#' @inheritSection epidatasets::jhu_confirmed_cumulative_num Data dictionary
#' @examples
#' # Since this is a re-exported dataset, it cannot be loaded using
#' # the `data()` function. `data()` looks for a file of the same name
#' # in the `data/` directory, which doesn't exist in this package.
#' # works
#' epiprocess::jhu_confirmed_cumulative_num
#'
#' # works
#' library(epiprocess)
#' jhu_confirmed_cumulative_num
#'
#' # fails
#' \dontrun{
#' data(jhu_confirmed_cumulative_num, package = "epiprocess")
#' }
#' @export
delayedAssign("jhu_confirmed_cumulative_num", epidatasets::jhu_confirmed_cumulative_num)

#' @inherit epidatasets::archive_cases_dv_subset description source references title
#' @inheritSection epidatasets::archive_cases_dv_subset Data dictionary
#' @examples
Expand Down
75 changes: 0 additions & 75 deletions man/jhu_confirmed_cumulative_num.Rd

This file was deleted.

2 changes: 1 addition & 1 deletion vignettes/aggregation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ library(covidcast)
x <- covid_incidence_county_subset
```

The data can also be fetched from the Delphi API with the following query:
The data can also be fetched from the Delphi Epidata API with the following query:
```{r, message = FALSE, eval = FALSE, warning = FALSE}
library(epidatr)
Expand Down
8 changes: 4 additions & 4 deletions vignettes/archive.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ library(ggplot2)
# This fetches the raw data backing the archive_cases_dv_subset object.
dv <- archive_cases_dv_subset$DT %>%
tibble()
as_tibble()
```

The data can also be fetched from the Delphi API with the following query:
The data can also be fetched from the Delphi Epidata API with the following query:
```{r, message = FALSE, warning = FALSE, eval = FALSE}
library(epidatr)
Expand Down Expand Up @@ -84,8 +84,8 @@ print(x)
```

An `epi_archive` is consists of a primary field `DT`, which is a data table
(from the `data.table` package) that has the columns `geo_value`, `time_value`,
`version` (and possibly additional ones), and other metadata fields, such as
(from the `data.table` package) that has at least the required columns
`geo_value`, `time_value`, and `version`; and other metadata fields, such as
`geo_type`.

The variables `geo_value`, `time_value`, `version` serve as **key variables**
Expand Down
13 changes: 7 additions & 6 deletions vignettes/correlation.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ library(dplyr)
The data is included in this package (via the [`epidatasets` package](https://cmu-delphi.github.io/epidatasets/)) and can be loaded with:
```{r}
x <- cases_deaths_subset %>%
select(geo_value, time_value, case_rate = case_rate_7d_av, death_rate = death_rate_7d_av) %>%
select(geo_value, time_value,
case_rate = case_rate_7d_av, death_rate = death_rate_7d_av) %>%
arrange(geo_value, time_value)
```

The data can also be fetched from the Delphi API with the following query:
The data can also be fetched from the Delphi Epidata API with the following query:
```{r, eval = FALSE}
library(epidatr)
Expand All @@ -36,21 +37,21 @@ d <- as.Date("2024-03-20")
x <- pub_covidcast(
source = "jhu-csse",
signals = "confirmed_7dav_incidence_prop",
time_type = "day",
geo_type = "state",
time_values = epirange(20200301, 20211231),
time_type = "day",
geo_values = "*",
time_values = epirange(20200301, 20211231),
as_of = d
) %>%
select(geo_value, time_value, case_rate = value)
y <- pub_covidcast(
source = "jhu-csse",
signals = "deaths_7dav_incidence_prop",
time_type = "day",
geo_type = "state",
time_values = epirange(20200301, 20211231),
time_type = "day",
geo_values = "*",
time_values = epirange(20200301, 20211231),
as_of = d
) %>%
select(geo_value, time_value, death_rate = value)
Expand Down
9 changes: 5 additions & 4 deletions vignettes/epiprocess.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,20 @@ which we also broadly refer to as signal variables. The documentation for
A data frame or tibble that has `geo_value` and `time_value` columns can be
converted into an `epi_df` object, using the function `as_epi_df()`. As an
example, we'll work with daily cumulative COVID-19 cases from four U.S. states:
CA, FL, NY, and TX, over time span from mid 2020 to early 2022, and we'll use
the [`epidatr`](https://github.com/cmu-delphi/epidatr) package
to fetch this data from the [COVIDcast
API](https://cmu-delphi.github.io/delphi-epidata/api/covidcast.html).
CA, FL, NY, and TX, over time span from mid 2020 to early 2022. We have included
this example data in the `epidatasets::jhu_confirmed_cumulative_num` object,
which we prepared by downloading the data using `epidatr::pub_covidcast()`.

```{r, message = FALSE}
library(epidatasets)
library(epiprocess)
library(dplyr)
library(tidyr)
library(withr)
cases <- jhu_confirmed_cumulative_num
class(cases)
colnames(cases)
```

Expand Down
2 changes: 1 addition & 1 deletion vignettes/growth_rate.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ x <- cases_deaths_subset %>%
arrange(geo_value, time_value)
```

The data can also be fetched from the Delphi API with the following query:
The data can also be fetched from the Delphi Epidata API with the following query:
```{r, message = FALSE, eval = FALSE}
library(epidatr)
Expand Down
2 changes: 1 addition & 1 deletion vignettes/outliers.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ reported COVID-19 case counts from FL and NJ.

The dataset has 730 rows and 3 columns.

```{r, echo=FALSE, warning=FALSE, message=FALSE}
```{r, echo=TRUE, warning=FALSE, message=FALSE}
library(epiprocess)
library(dplyr)
library(tidyr)
Expand Down
2 changes: 1 addition & 1 deletion vignettes/slide.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ edf <- cases_deaths_subset %>%
arrange(geo_value, time_value)
```

The data can also be fetched from the Delphi API with the following query:
The data can also be fetched from the Delphi Epidata API with the following query:
```{r, message = FALSE, eval = FALSE}
library(epidatr)
Expand Down

0 comments on commit 888bb57

Please sign in to comment.