Skip to content

Commit cb3fd29

Browse files
committed
docs: document (GHA)
1 parent b3a9110 commit cb3fd29

File tree

1 file changed

+44
-41
lines changed

1 file changed

+44
-41
lines changed

README.md

+44-41
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1+
12
<!-- README.md is generated from README.Rmd. Please edit that file -->
23

34
# epiprocess
45

6+
## TODO: Condense these paragraphs
7+
58
The [`{epiprocess}`](https://cmu-delphi.github.io/epiprocess/) package
69
works with epidemiological time series data to provide situational
710
awareness, processing, and transformations in preparation for modeling,
811
and version-faithful model backtesting. It contains:
912

10-
- `epi_df`, a class for working with epidemiological time series data
11-
which behaves like a tibble (and can be manipulated with
12-
[`{dplyr}`](https://dplyr.tidyverse.org/)-esque “verbs”) but with
13-
some additional structure;
14-
- `epi_archive`, a class for working with the version history of such
15-
time series data;
16-
- sample epidemiological data in these formats;
13+
- `epi_df`, a class for working with epidemiological time series data
14+
which behaves like a tibble (and can be manipulated with
15+
[`{dplyr}`](https://dplyr.tidyverse.org/)-esque “verbs”) but with
16+
some additional structure;
17+
- `epi_archive`, a class for working with the version history of such
18+
time series data;
19+
- sample epidemiological data in these formats;
1720

1821
This package is provided by the Delphi group at Carnegie Mellon
1922
University. The Delphi group provides many tools also hosts the Delphi
@@ -48,7 +51,7 @@ many common tasks instead.
4851

4952
To install:
5053

51-
```r
54+
``` r
5255
# Stable version
5356
pak::pkg_install("cmu-delphi/epiprocess@main")
5457

@@ -63,7 +66,7 @@ The package is not yet on CRAN.
6366
Once `epiprocess` and `epidatr` are installed, you can use the following
6467
code to get started:
6568

66-
```r
69+
``` r
6770
library(epiprocess)
6871
library(epidatr)
6972
library(dplyr)
@@ -74,7 +77,7 @@ Get COVID-19 confirmed cumulative case data from JHU CSSE for
7477
California, Florida, New York, and Texas, from March 1, 2020 to January
7578
31, 2022
7679

77-
```r
80+
``` r
7881
df <- pub_covidcast(
7982
source = "jhu-csse",
8083
signals = "confirmed_cumulative_num",
@@ -101,11 +104,11 @@ df
101104
#> # ℹ 2,798 more rows
102105
```
103106

104-
Convert the data to an epi_df object and sort by geo_value and
105-
time_value. You can work with the epi_df object like a tibble using
107+
Convert the data to an epi\_df object and sort by geo\_value and
108+
time\_value. You can work with the epi\_df object like a tibble using
106109
dplyr
107110

108-
```r
111+
``` r
109112
edf <- df %>%
110113
as_epi_df() %>%
111114
arrange_canonical() %>%
@@ -115,8 +118,8 @@ edf
115118
#> An `epi_df` object, 2,808 x 4 with metadata:
116119
#> * geo_type = state
117120
#> * time_type = day
118-
#> * as_of = 2024-10-04 13:32:23.730165
119-
#>
121+
#> * as_of = 2024-10-04 22:31:35.502626
122+
#>
120123
#> # A tibble: 2,808 × 4
121124
#> # Groups: geo_value [4]
122125
#> geo_value time_value cases_cumulative cases_daily
@@ -134,56 +137,56 @@ edf
134137
#> # ℹ 2,798 more rows
135138
```
136139

137-
Autoplot the confirmed daily cases for each geo_value
140+
Autoplot the confirmed daily cases for each geo\_value
138141

139-
```r
142+
``` r
140143
edf %>%
141144
autoplot(cases_cumulative)
142145
```
143146

144147
<img src="man/figures/README-unnamed-chunk-6-1.png" width="100%" />
145148

146149
Compute the 7 day moving average of the confirmed daily cases for each
147-
geo_value
150+
geo\_value
148151

149-
```r
152+
``` r
150153
edf %>%
151154
group_by(geo_value) %>%
152155
epi_slide_mean(cases_daily, .window_size = 7, na.rm = TRUE)
153156
#> An `epi_df` object, 2,808 x 5 with metadata:
154157
#> * geo_type = state
155158
#> * time_type = day
156-
#> * as_of = 2024-10-04 13:32:23.730165
157-
#>
159+
#> * as_of = 2024-10-04 22:31:35.502626
160+
#>
158161
#> # A tibble: 2,808 × 5
159162
#> # Groups: geo_value [4]
160163
#> geo_value time_value cases_cumulative cases_daily slide_value_cases_daily
161164
#> * <chr> <date> <dbl> <dbl> <dbl>
162-
#> 1 ca 2020-03-01 19 19 19
163-
#> 2 ca 2020-03-02 23 4 11.5
165+
#> 1 ca 2020-03-01 19 19 19
166+
#> 2 ca 2020-03-02 23 4 11.5
164167
#> 3 ca 2020-03-03 29 6 9.67
165-
#> 4 ca 2020-03-04 40 11 10
166-
#> 5 ca 2020-03-05 50 10 10
167-
#> 6 ca 2020-03-06 68 18 11.3
168-
#> 7 ca 2020-03-07 94 26 13.4
169-
#> 8 ca 2020-03-08 113 19 13.4
170-
#> 9 ca 2020-03-09 136 23 16.1
171-
#> 10 ca 2020-03-10 158 22 18.4
168+
#> 4 ca 2020-03-04 40 11 10
169+
#> 5 ca 2020-03-05 50 10 10
170+
#> 6 ca 2020-03-06 68 18 11.3
171+
#> 7 ca 2020-03-07 94 26 13.4
172+
#> 8 ca 2020-03-08 113 19 13.4
173+
#> 9 ca 2020-03-09 136 23 16.1
174+
#> 10 ca 2020-03-10 158 22 18.4
172175
#> # ℹ 2,798 more rows
173176
```
174177

175178
Compute the growth rate of the confirmed cumulative cases for each
176-
geo_value
179+
geo\_value
177180

178-
```r
181+
``` r
179182
edf %>%
180183
group_by(geo_value) %>%
181184
mutate(cases_growth = growth_rate(x = time_value, y = cases_cumulative, method = "rel_change", h = 7))
182185
#> An `epi_df` object, 2,808 x 5 with metadata:
183186
#> * geo_type = state
184187
#> * time_type = day
185-
#> * as_of = 2024-10-04 13:32:23.730165
186-
#>
188+
#> * as_of = 2024-10-04 22:31:35.502626
189+
#>
187190
#> # A tibble: 2,808 × 5
188191
#> # Groups: geo_value [4]
189192
#> geo_value time_value cases_cumulative cases_daily cases_growth
@@ -204,7 +207,7 @@ edf %>%
204207
Detect outliers in the growth rate of the confirmed cumulative cases for
205208
each
206209

207-
```r
210+
``` r
208211
edf %>%
209212
group_by(geo_value) %>%
210213
mutate(outlier_info = detect_outlr(x = time_value, y = cases_daily)) %>%
@@ -228,8 +231,8 @@ edf %>%
228231
#> An `epi_df` object, 2,808 x 5 with metadata:
229232
#> * geo_type = state
230233
#> * time_type = day
231-
#> * as_of = 2024-10-04 13:32:23.730165
232-
#>
234+
#> * as_of = 2024-10-04 22:31:35.502626
235+
#>
233236
#> # A tibble: 2,808 × 5
234237
#> geo_value time_value cases_cumulative cases_daily outlier_info$rm_geo_value
235238
#> * <chr> <date> <dbl> <dbl> <dbl>
@@ -249,11 +252,11 @@ edf %>%
249252
#> # $combined_replacement <dbl>
250253
```
251254

252-
Add a column to the epi_df object with the daily deaths for each
253-
geo_value and compute the correlations between cases and deaths for
254-
each geo_value
255+
Add a column to the epi\_df object with the daily deaths for each
256+
geo\_value and compute the correlations between cases and deaths for
257+
each geo\_value
255258

256-
```r
259+
``` r
257260
df <- pub_covidcast(
258261
source = "jhu-csse",
259262
signals = "deaths_incidence_num",

0 commit comments

Comments
 (0)