Skip to content

Commit 7bf94e3

Browse files
authored
Merge pull request #530 from cmu-delphi/dev
catch main up to dev, epiprocess 0.9.0
2 parents 16f38b2 + 44e7095 commit 7bf94e3

File tree

97 files changed

+5767
-3839
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+5767
-3839
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@
1616
^.lintr$
1717
^DEVELOPMENT.md$
1818
man-roxygen
19+
^.venv$
20+
^sandbox.R$

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ docs
1313
renv/
1414
renv.lock
1515
.Rprofile
16+
sandbox.R

DESCRIPTION

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
Type: Package
22
Package: epiprocess
33
Title: Tools for basic signal processing in epidemiology
4-
Version: 0.8.0
4+
Version: 0.9.0
55
Authors@R: c(
66
person("Jacob", "Bien", role = "ctb"),
7-
person("Logan", "Brooks", email = "[email protected]", role = c("aut", "cre")),
7+
person("Logan", "Brooks", , "[email protected]", role = c("aut", "cre")),
88
person("Rafael", "Catoia", role = "ctb"),
99
person("Nat", "DeFries", role = "ctb"),
1010
person("Daniel", "McDonald", role = "aut"),
@@ -15,23 +15,30 @@ Authors@R: c(
1515
person("Evan", "Ray", role = "aut"),
1616
person("Dmitry", "Shemetov", role = "ctb"),
1717
person("Ryan", "Tibshirani", role = "aut"),
18-
person("Lionel", "Henry", role = "ctb", comment = "Author of included rlang fragments"),
19-
person("Hadley", "Wickham", role = "ctb", comment = "Author of included rlang fragments"),
20-
person("Posit", role = "cph", comment = "Copyright holder of included rlang fragments")
18+
person("Lionel", "Henry", role = "ctb",
19+
comment = "Author of included rlang fragments"),
20+
person("Hadley", "Wickham", role = "ctb",
21+
comment = "Author of included rlang fragments"),
22+
person("Posit", role = "cph",
23+
comment = "Copyright holder of included rlang fragments")
2124
)
22-
Description: This package introduces a common data structure for epidemiological
23-
data reported by location and time, provides another data structure to
24-
work with revisions to these data sets over time, and offers associated
25-
utilities to perform basic signal processing tasks.
25+
Description: This package introduces a common data structure for
26+
epidemiological data reported by location and time, provides another
27+
data structure to work with revisions to these data sets over time,
28+
and offers associated utilities to perform basic signal processing
29+
tasks.
2630
License: MIT + file LICENSE
27-
Copyright: file inst/COPYRIGHTS
31+
URL: https://cmu-delphi.github.io/epiprocess/
32+
Depends:
33+
R (>= 3.6)
2834
Imports:
2935
checkmate,
3036
cli,
3137
data.table,
32-
dplyr (>= 1.0.0),
38+
dplyr (>= 1.0.8),
3339
genlasso,
3440
ggplot2,
41+
glue,
3542
lifecycle (>= 1.0.1),
3643
lubridate,
3744
magrittr,
@@ -43,7 +50,8 @@ Imports:
4350
tidyselect (>= 1.2.0),
4451
tsibble,
4552
utils,
46-
vctrs
53+
vctrs,
54+
waldo
4755
Suggests:
4856
covidcast,
4957
devtools,
@@ -57,22 +65,22 @@ VignetteBuilder:
5765
knitr
5866
Remotes:
5967
cmu-delphi/epidatr,
60-
reconverse/outbreaks,
61-
glmgen/genlasso
68+
glmgen/genlasso,
69+
reconverse/outbreaks
6270
Config/testthat/edition: 3
71+
Config/testthat/parallel: true
72+
Copyright: file inst/COPYRIGHTS
6373
Encoding: UTF-8
6474
LazyData: true
6575
Roxygen: list(markdown = TRUE)
6676
RoxygenNote: 7.3.2
67-
Depends:
68-
R (>= 2.10)
69-
URL: https://cmu-delphi.github.io/epiprocess/
7077
Collate:
7178
'archive.R'
7279
'autoplot.R'
7380
'correlation.R'
7481
'data.R'
7582
'epi_df.R'
83+
'epi_df_forbidden_methods.R'
7684
'epiprocess.R'
7785
'group_by_epi_df_methods.R'
7886
'methods-epi_archive.R'
@@ -82,6 +90,7 @@ Collate:
8290
'methods-epi_df.R'
8391
'outliers.R'
8492
'reexports.R'
93+
'revision_analysis.R'
8594
'slide.R'
8695
'utils.R'
8796
'utils_pipe.R'

NAMESPACE

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
S3method("[",epi_df)
44
S3method("names<-",epi_df)
5+
S3method(Summary,epi_df)
6+
S3method(arrange_canonical,default)
7+
S3method(arrange_canonical,epi_df)
8+
S3method(arrange_col_canonical,default)
9+
S3method(arrange_col_canonical,epi_df)
10+
S3method(arrange_row_canonical,default)
11+
S3method(arrange_row_canonical,epi_df)
512
S3method(as_epi_df,data.frame)
613
S3method(as_epi_df,epi_df)
714
S3method(as_epi_df,tbl_df)
@@ -11,6 +18,7 @@ S3method(as_tsibble,epi_df)
1118
S3method(autoplot,epi_df)
1219
S3method(clone,epi_archive)
1320
S3method(clone,grouped_epi_archive)
21+
S3method(complete,epi_df)
1422
S3method(dplyr_col_modify,col_modify_recorder_df)
1523
S3method(dplyr_col_modify,epi_df)
1624
S3method(dplyr_reconstruct,epi_df)
@@ -24,6 +32,7 @@ S3method(group_by,epi_df)
2432
S3method(group_by,grouped_epi_archive)
2533
S3method(group_by_drop_default,grouped_epi_archive)
2634
S3method(group_modify,epi_df)
35+
S3method(group_vars,grouped_epi_archive)
2736
S3method(groups,grouped_epi_archive)
2837
S3method(guess_period,Date)
2938
S3method(guess_period,POSIXt)
@@ -32,24 +41,26 @@ S3method(key_colnames,data.frame)
3241
S3method(key_colnames,default)
3342
S3method(key_colnames,epi_archive)
3443
S3method(key_colnames,epi_df)
44+
S3method(mean,epi_df)
3545
S3method(next_after,Date)
3646
S3method(next_after,integer)
3747
S3method(print,epi_archive)
3848
S3method(print,epi_df)
3949
S3method(print,grouped_epi_archive)
40-
S3method(select,epi_df)
4150
S3method(summary,epi_df)
4251
S3method(ungroup,epi_df)
4352
S3method(ungroup,grouped_epi_archive)
4453
S3method(unnest,epi_df)
4554
export("%>%")
4655
export(archive_cases_dv_subset)
4756
export(arrange)
57+
export(arrange_canonical)
4858
export(as_epi_archive)
4959
export(as_epi_df)
5060
export(as_tsibble)
5161
export(autoplot)
5262
export(clone)
63+
export(complete)
5364
export(detect_outlr)
5465
export(detect_outlr_rm)
5566
export(detect_outlr_stl)
@@ -64,8 +75,10 @@ export(epix_merge)
6475
export(epix_slide)
6576
export(epix_truncate_versions_after)
6677
export(filter)
78+
export(full_seq)
6779
export(geo_column_names)
6880
export(group_by)
81+
export(group_epi_df)
6982
export(group_modify)
7083
export(growth_rate)
7184
export(guess_period)
@@ -79,7 +92,9 @@ export(new_epi_df)
7992
export(next_after)
8093
export(relocate)
8194
export(rename)
95+
export(revision_summary)
8296
export(slice)
97+
export(sum_groups_epi_df)
8398
export(time_column_names)
8499
export(ungroup)
85100
export(unnest)
@@ -109,6 +124,7 @@ importFrom(checkmate,vname)
109124
importFrom(cli,cat_line)
110125
importFrom(cli,cli_abort)
111126
importFrom(cli,cli_inform)
127+
importFrom(cli,cli_li)
112128
importFrom(cli,cli_vec)
113129
importFrom(cli,cli_warn)
114130
importFrom(cli,format_message)
@@ -126,25 +142,35 @@ importFrom(data.table,set)
126142
importFrom(data.table,setDF)
127143
importFrom(data.table,setkeyv)
128144
importFrom(dplyr,"%>%")
145+
importFrom(dplyr,across)
146+
importFrom(dplyr,all_of)
129147
importFrom(dplyr,arrange)
130148
importFrom(dplyr,bind_rows)
149+
importFrom(dplyr,c_across)
131150
importFrom(dplyr,dplyr_col_modify)
132151
importFrom(dplyr,dplyr_reconstruct)
133152
importFrom(dplyr,dplyr_row_slice)
134153
importFrom(dplyr,everything)
135154
importFrom(dplyr,filter)
136155
importFrom(dplyr,group_by)
137156
importFrom(dplyr,group_by_drop_default)
157+
importFrom(dplyr,group_map)
138158
importFrom(dplyr,group_modify)
139159
importFrom(dplyr,group_vars)
140160
importFrom(dplyr,groups)
141161
importFrom(dplyr,if_all)
142162
importFrom(dplyr,if_any)
163+
importFrom(dplyr,if_else)
164+
importFrom(dplyr,lag)
143165
importFrom(dplyr,mutate)
166+
importFrom(dplyr,near)
167+
importFrom(dplyr,pick)
168+
importFrom(dplyr,pull)
144169
importFrom(dplyr,relocate)
145170
importFrom(dplyr,rename)
146171
importFrom(dplyr,select)
147172
importFrom(dplyr,slice)
173+
importFrom(dplyr,summarize)
148174
importFrom(dplyr,tibble)
149175
importFrom(dplyr,ungroup)
150176
importFrom(ggplot2,autoplot)
@@ -176,6 +202,7 @@ importFrom(rlang,is_formula)
176202
importFrom(rlang,is_function)
177203
importFrom(rlang,is_missing)
178204
importFrom(rlang,is_quosure)
205+
importFrom(rlang,list2)
179206
importFrom(rlang,missing_arg)
180207
importFrom(rlang,new_function)
181208
importFrom(rlang,quo_get_expr)
@@ -194,6 +221,8 @@ importFrom(stats,median)
194221
importFrom(tibble,as_tibble)
195222
importFrom(tibble,new_tibble)
196223
importFrom(tibble,validate_tibble)
224+
importFrom(tidyr,complete)
225+
importFrom(tidyr,full_seq)
197226
importFrom(tidyr,unnest)
198227
importFrom(tidyselect,any_of)
199228
importFrom(tidyselect,eval_select)

NEWS.md

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,74 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.x.y will indicat
44

55
# epiprocess 0.9
66

7+
## Breaking changes
8+
9+
- `epi_slide` interface has major breaking changes.
10+
- All variables are now dot-prefixed to be more consistent with tidyverse
11+
style for functions that allow tidyeval.
12+
- The `before/after` arguments have been replaced with the `.window_size` and
13+
`.align` arguments.
14+
- `names_sep` has been removed. If you return data frames from your
15+
computations:
16+
- without a name, they will be unpacked into separate columns without name
17+
prefixes
18+
- with a name, it will become a packed data.frame-class column (see
19+
`tidyr::pack`).
20+
- `as_list_col` has been removed. You can now directly return a list from your
21+
slide computations instead. If you were using `as_list_col=TRUE`, you will
22+
need to wrap your output in a list.
23+
- Ungrouped slides are no longer allowed in `epi_slide`. If you used this for
24+
geographic aggregation up to national, consider using `sum_groups_epi_df`.
25+
- Added `sum_groups_epi_df` to allow aggregation across key columns prior to
26+
sliding.
27+
- `epix_slide` interface has major changes.
28+
- All variables are now dot-prefixed to be more consistent with tidyverse
29+
style for functions that allow tidyeval.
30+
- `names_sep` has been removed. If you return data frames from your
31+
computations:
32+
- without a name, they will be unpacked into separate columns without name
33+
prefixes
34+
- with a name, it will become a packed data.frame-class column (see
35+
`tidyr::pack`).
36+
- `as_list_col` has been removed. You can now directly return a list from your
37+
slide computations instead. If you were using `as_list_col=TRUE`, you will
38+
need to wrap your output in a list.
39+
- `as_epi_df()` now checks that every group has unique time values and errors if
40+
this is not the case. The same check is performed at the beginning of
41+
`epi_slide()`. This check is currently not enforced in dplyr operations (like
42+
for joins, mutates, or select), but we plan to add it in the future.
43+
- `as_epi_df()` or `as_epi_archive()` no longer accept `additional_metadata`.
44+
Use the new `other_keys` arg to specify additional key columns, such as age
45+
group columns or other demographic breakdowns. Miscellaneous metadata are no
46+
longer handled by `epiprocess`, but you can use R's built-in `attr<-` instead
47+
for a similar feature.
48+
49+
## Improvements
50+
51+
- Added `complete.epi_df`, which fills in missing values in an `epi_df` with
52+
`NA`s. Uses `tidyr::complete` underneath and preserves `epi_df` metadata.
53+
- Inclusion of the function `revision_summary` to provide basic revision
54+
information for `epi_archive`s out of the box. (#492)
55+
56+
## Bug fixes
57+
58+
- Fix `epi_slide_opt` (and related functions) to correctly handle `before=Inf`.
59+
Also allow multiple columns specified as a list of strings.
60+
- Disallow `after=Inf` in slide functions, since it doesn't seem like a likely
61+
use case and complicates code.
62+
763
# epiprocess 0.8
864

965
## Breaking changes
1066

67+
- `epi_df`'s are now more strict about what types they allow in the time column.
68+
Namely, we are explicit about only supporting `Date` at the daily and weekly
69+
cadence and generic integer types (for yearly cadence).
70+
- `epi_slide` `before` and `after` arguments are now require the user to
71+
specific time units in certain cases. The `time_step` argument has been
72+
removed.
73+
- `epix_slide` `before` argument now defaults to `Inf`, and requires the user to
74+
specify units in some cases. The `time_step` argument has been removed.
1175
- `detect_outlr_stl(seasonal_period = NULL)` is no longer accepted. Use
1276
`detect_outlr_stl(seasonal_period = <value>, seasonal_as_residual = TRUE)`
1377
instead. See `?detect_outlr_stl` for more details.
@@ -50,6 +114,12 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.x.y will indicat
50114
are similar functions for `geo` and `version`).
51115
- Fixed bug where `epix_slide_ref_time_values_default()` on datetimes would
52116
output a huge number of `ref_time_values` spaced apart by mere seconds.
117+
- In `epi_slide()` and `epix_slide()`:
118+
- Multiple "data-masking" tidy evaluation expressions can be passed in via
119+
`...`, rather than just one.
120+
- Additional tidy evaluation features from `dplyr::mutate` are supported: `!!
121+
name_var := value`, unnamed expressions evaluating to data frames, and `=
122+
NULL`; see `?epi_slide` for more details.
53123

54124
## Cleanup
55125

@@ -58,17 +128,6 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.x.y will indicat
58128
of `epi_df`s to let `{epipredict}` work more easily with other libraries (#471).
59129
- Removed some external package dependencies.
60130

61-
## Breaking Changes
62-
63-
- `epi_df`'s are now more strict about what types they allow in the time column.
64-
Namely, we are explicit about only supporting `Date` at the daily and weekly
65-
cadence and generic integer types (for yearly cadence).
66-
- `epi_slide` `before` and `after` arguments are now require the user to
67-
specific time units in certain cases. The `time_step` argument has been
68-
removed.
69-
- `epix_slide` `before` argument now defaults to `Inf`, and requires the user to
70-
specify units in some cases. The `time_step` argument has been removed.
71-
72131
# epiprocess 0.7.0
73132

74133
## Breaking changes:

0 commit comments

Comments
 (0)