Skip to content

Commit 56099d0

Browse files
authored
Merge pull request #555 from cmu-delphi/ds/vignettes
doc: updates from review
2 parents c901a68 + a3bca2d commit 56099d0

16 files changed

+80
-270
lines changed

DEVELOPMENT.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,20 @@ Our CI builds two version of the documentation:
2626
- https://cmu-delphi.github.io/epiprocess/ from the `main` branch and
2727
- https://cmu-delphi.github.io/epiprocess/dev from the `dev` branch.
2828

29-
We include the script `pkgdown-watch.R` that will automatically rebuild the
30-
documentation locally and preview it. It can be used with:
29+
Commands for developing the documentation site:
3130

3231
```sh
33-
# Make sure you have servr installed
34-
R -e 'renv::install("servr")'
35-
# Will start a local server
36-
Rscript pkgdown-watch.R
37-
# You may need to first build the site with
32+
# Basic build and preview
33+
R -e 'pkgdown::clean_site()'
34+
R -e 'devtools::document()'
35+
R -e 'pkgdown::build_site()'
36+
37+
# A smart rebuild workflow for non-RStudio users.
38+
# You may need to first build the site.
3839
R -e 'pkgdown::build_site(".", examples = FALSE, devel = TRUE, preview = FALSE)'
40+
R -e 'renv::install("servr")'
41+
# Will start a local docs server and monitor for changes.
42+
Rscript inst/pkgdown-watch.R
3943
```
4044

4145
## Versioning

R/methods-epi_archive.R

+3-4
Original file line numberDiff line numberDiff line change
@@ -627,10 +627,9 @@ epix_detailed_restricted_mutate <- function(.data, ...) {
627627
#' Slides a given function over variables in an `epi_archive` object. This
628628
#' behaves similarly to `epi_slide()`, with the key exception that it is
629629
#' version-aware: the sliding computation at any given reference time t is
630-
#' performed on **data that would have been available as of t**. See the
631-
#' [archive
632-
#' vignette](https://cmu-delphi.github.io/epiprocess/articles/archive.html) for
633-
#' examples.
630+
#' performed on **data that would have been available as of t**. This function
631+
#' is intended for use in accurate backtesting of models; see
632+
#' `vignette("backtesting", package="epipredict")` for a walkthrough.
634633
#'
635634
#' @param .x An [`epi_archive`] or [`grouped_epi_archive`] object. If ungrouped,
636635
#' all data in `x` will be treated as part of a single data group.

R/slide.R

+7-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
#' as follows:
77
#'
88
#' ```
9-
#' # To compute the 7-day trailing average of cases
10-
#' epi_slide(edf, cases_7dav = mean(cases), .window_size = 7)
9+
#' # Create new column `cases_7dm` that contains a 7-day trailing median of cases
10+
#' epi_slide(edf, cases_7dav = median(cases), .window_size = 7)
1111
#' ```
1212
#'
13-
#' This will create the new column `cases_7dav` that contains a 7-day rolling
14-
#' average of values in "cases". See `vignette("epi_df")` for more examples.
13+
#' For two very common use cases, we provide optimized functions that are much
14+
#' faster than `epi_slide`: `epi_slide_mean()` and `epi_slide_sum()`. We
15+
#' recommend using these functions when possible.
16+
#'
17+
#' See `vignette("epi_df")` for more examples.
1518
#'
1619
#' @template basic-slide-params
1720
#' @param .f Function, formula, or missing; together with `...` specifies the

README.Rmd

+14-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ output: github_document
55
<!-- README.md is generated from README.Rmd. Please edit that file -->
66

77
```{r, include = FALSE}
8-
source(here::here("vignettes", "_common.R"))
8+
source(file.path("vignettes", "_common.R"))
99
knitr::opts_chunk$set(
1010
fig.path = "man/figures/README-"
1111
)
@@ -16,7 +16,7 @@ knitr::opts_chunk$set(
1616
The `{epiprocess}` package works with epidemiological time series data and
1717
provides tools to manage, analyze, and process the data in preparation for
1818
modeling. It is designed to work in tandem with
19-
[`{epipredict}`](https://cmu-delphi.github.io/epipredict/), which provides
19+
[epipredict](https://cmu-delphi.github.io/epipredict/), which provides
2020
pre-built epiforecasting models and as well as tools to build custom models.
2121
Both packages are designed to lower the barrier to entry and implementation cost
2222
for epidemiological time series analysis and forecasting.
@@ -25,13 +25,18 @@ for epidemiological time series analysis and forecasting.
2525

2626
- `epi_df()` and `epi_archive()`, two data frame classes (that work like a
2727
`{tibble}` with `{dplyr}` verbs) for working with epidemiological time
28-
series data;
28+
series data
29+
- `epi_df` is for working with a snapshot of data at a single point in time
30+
- `epi_archive` is for working with histories of data that changes over time
31+
- one of the most common uses of `epi_archive` is for accurate backtesting of
32+
forecasting models, see `vignette("backtesting", package="epipredict")`
2933
- signal processing tools building on these data structures such as
30-
- `epi_slide()` for sliding window operations;
31-
- `epix_slide()` for sliding window operations on archives;
32-
- `growth_rate()` for computing growth rates;
33-
- `detect_outlr()` for outlier detection;
34-
- `epi_cor()` for computing correlations;
34+
- `epi_slide()` for sliding window operations (aids with feature creation)
35+
- `epix_slide()` for sliding window operations on archives (aids with
36+
backtesting)
37+
- `growth_rate()` for computing growth rates
38+
- `detect_outlr()` for outlier detection
39+
- `epi_cor()` for computing correlations
3540

3641
If you are new to this set of tools, you may be interested learning through a
3742
book format: [Introduction to Epidemiological
@@ -41,7 +46,7 @@ You may also be interested in:
4146

4247
- `{epidatr}`, for accessing wide range
4348
of epidemiological data sets, including COVID-19 data, flu data, and more.
44-
- `{rtestim}`, a package for estimating
49+
- [rtestim](https://github.com/dajmcdon/rtestim), a package for estimating
4550
the time-varying reproduction number of an epidemic.
4651

4752
This package is provided by the [Delphi group](https://delphi.cmu.edu/) at

README.md

+21-12
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,32 @@
66
The `{epiprocess}` package works with epidemiological time series data
77
and provides tools to manage, analyze, and process the data in
88
preparation for modeling. It is designed to work in tandem with
9-
[`{epipredict}`](https://cmu-delphi.github.io/epipredict/), which
10-
provides pre-built epiforecasting models and as well as tools to build
11-
custom models. Both packages are designed to lower the barrier to entry
12-
and implementation cost for epidemiological time series analysis and
9+
[epipredict](https://cmu-delphi.github.io/epipredict/), which provides
10+
pre-built epiforecasting models and as well as tools to build custom
11+
models. Both packages are designed to lower the barrier to entry and
12+
implementation cost for epidemiological time series analysis and
1313
forecasting.
1414

1515
`{epiprocess}` contains:
1616

1717
- `epi_df()` and `epi_archive()`, two data frame classes (that work
1818
like a `{tibble}` with `{dplyr}` verbs) for working with
19-
epidemiological time series data;
19+
epidemiological time series data
20+
- `epi_df` is for working with a snapshot of data at a single
21+
point in time
22+
- `epi_archive` is for working with histories of data that changes
23+
over time
24+
- one of the most common uses of `epi_archive` is for accurate
25+
backtesting of forecasting models, see `vignette("backtesting",
26+
package="epipredict")`
2027
- signal processing tools building on these data structures such as
21-
- `epi_slide()` for sliding window operations;
22-
- `epix_slide()` for sliding window operations on archives;
23-
- `growth_rate()` for computing growth rates;
24-
- `detect_outlr()` for outlier detection;
25-
- `epi_cor()` for computing correlations;
28+
- `epi_slide()` for sliding window operations (aids with feature
29+
creation)
30+
- `epix_slide()` for sliding window operations on archives (aids
31+
with backtesting)
32+
- `growth_rate()` for computing growth rates
33+
- `detect_outlr()` for outlier detection
34+
- `epi_cor()` for computing correlations
2635

2736
If you are new to this set of tools, you may be interested learning
2837
through a book format: [Introduction to Epidemiological
@@ -32,8 +41,8 @@ You may also be interested in:
3241

3342
- `{epidatr}`, for accessing wide range of epidemiological data sets,
3443
including COVID-19 data, flu data, and more.
35-
- `{rtestim}`, a package for estimating the time-varying reproduction
36-
number of an epidemic.
44+
- [rtestim](https://github.com/dajmcdon/rtestim), a package for
45+
estimating the time-varying reproduction number of an epidemic.
3746

3847
This package is provided by the [Delphi group](https://delphi.cmu.edu/)
3948
at Carnegie Mellon University.

pkgdown-watch.R renamed to inst/pkgdown-watch.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ servr::httw(
3636
refs <- grep("man.+R(m?d)?$", files, value = TRUE)
3737
if (length(refs)) {
3838
# Doesn't work for me, so I run it manually.
39-
# pkgdown::build_reference(pkg, preview = FALSE, examples = FALSE, lazy = FALSE)
39+
# pkgdown::build_reference(pkg, preview = FALSE, examples = FALSE, lazy = FALSE) # nolint: commented_code_linter
4040
}
4141

4242
pkgdown <- grep("pkgdown", files, value = TRUE)

man/epi_slide.Rd

+7-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/epix_slide.Rd

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-746 Bytes
Loading

vignettes/compactify.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ vignette: >
88
---
99

1010
```{r, include = FALSE}
11-
source(here::here("vignettes", "_common.R"))
11+
source("_common.R")
1212
```
1313

1414
## Removing redundant update data to save space

vignettes/correlation.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ vignette: >
88
---
99

1010
```{r, include = FALSE}
11-
source(here::here("vignettes", "_common.R"))
11+
source("_common.R")
1212
```
1313

1414
The `epiprocess` package provides some simple functionality for computing lagged

0 commit comments

Comments
 (0)