Skip to content

Commit 1af42ba

Browse files
committed
Merge branch 'dev' into lcb/update-actions-and-pkgdown
2 parents 909c983 + b444a3c commit 1af42ba

25 files changed

+895
-735
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: epiprocess
33
Title: Tools for basic signal processing in epidemiology
4-
Version: 0.7.0
4+
Version: 0.7.0.9999
55
Authors@R: c(
66
person("Jacob", "Bien", role = "ctb"),
77
person("Logan", "Brooks", role = "aut"),

NAMESPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ importFrom(data.table,as.data.table)
6666
importFrom(data.table,between)
6767
importFrom(data.table,copy)
6868
importFrom(data.table,key)
69+
importFrom(data.table,rbindlist)
6970
importFrom(data.table,set)
71+
importFrom(data.table,setDF)
7072
importFrom(data.table,setkeyv)
7173
importFrom(dplyr,arrange)
7274
importFrom(dplyr,bind_rows)
@@ -114,6 +116,8 @@ importFrom(rlang,syms)
114116
importFrom(stats,cor)
115117
importFrom(stats,median)
116118
importFrom(tibble,as_tibble)
119+
importFrom(tibble,new_tibble)
120+
importFrom(tibble,validate_tibble)
117121
importFrom(tidyr,unnest)
118122
importFrom(tidyselect,eval_select)
119123
importFrom(tidyselect,starts_with)

NEWS.md

Lines changed: 95 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1+
2+
# epiprocess 0.7.0.9999
3+
4+
## Improvements
5+
6+
* Updated vignettes for compatibility with epidatr 1.0.0 in PR #377.
7+
18
# epiprocess 0.7.0
29

310
Note that `epiprocess` uses the [Semantic Versioning
411
("semver")](https://semver.org/) scheme for all release versions, but any
512
inter-release development versions will include an additional ".9999" suffix.
613

7-
## Breaking changes:
14+
## Breaking changes
815

916
* Changes to `epi_slide` and `epix_slide`:
1017
* If `f` is a function, it is now required to take at least three arguments.
@@ -19,11 +26,11 @@ inter-release development versions will include an additional ".9999" suffix.
1926
g, <any other arguments>) { <body> }` to `f = function(x, g, rt, <any
2027
other arguments>) { <body> }`.
2128

22-
## New features:
29+
## New features
2330

24-
* `epi_slide` and `epix_slide` also make the window data, group key and reference
25-
time value available to slide computations specified as formulas or tidy
26-
evaluation expressions, in additional or completely new ways.
31+
* `epi_slide` and `epix_slide` also make the window data, group key and
32+
reference time value available to slide computations specified as formulas or
33+
tidy evaluation expressions, in additional or completely new ways.
2734
* If `f` is a formula, it can now access the reference time value via `.z` or
2835
`.ref_time_value`.
2936
* If `f` is missing, the tidy evaluation expression in `...` can now refer to
@@ -45,17 +52,21 @@ inter-release development versions will include an additional ".9999" suffix.
4552
* To keep the old behavior, convert the output of `epix_slide()` to `epi_df`
4653
when desired and set the metadata appropriately.
4754

48-
## Improvements:
55+
## Improvements
4956

5057
* `epi_slide` and `epix_slide` now support `as_list_col = TRUE` when the slide
5158
computations output atomic vectors, and output a list column in "chopped"
5259
format (see `tidyr::chop`).
5360
* `epi_slide` now works properly with slide computations that output just a
5461
`Date` vector, rather than converting `slide_value` to a numeric column.
62+
* Fix `?archive_cases_dv_subset` information regarding modifications of upstream
63+
data by @brookslogan in (#299).
64+
* Update to use updated `epidatr` (`fetch_tbl` -> `fetch`) by @brookslogan in
65+
(#319).
5566

5667
# epiprocess 0.6.0
5768

58-
## Breaking changes:
69+
## Breaking changes
5970

6071
* Changes to both `epi_slide` and `epix_slide`:
6172
* The `n`, `align`, and `before` arguments have been replaced by new `before`
@@ -102,7 +113,7 @@ inter-release development versions will include an additional ".9999" suffix.
102113
the old behavior, pass in `clobberable_versions_start =
103114
max_version_with_row_in(x)`.
104115

105-
## Potentially-breaking changes:
116+
## Potentially-breaking changes
106117

107118
* Fixed `[` on grouped `epi_df`s to maintain the grouping if possible when
108119
dropping the `epi_df` class (e.g., when removing the `time_value` column).
@@ -116,15 +127,15 @@ inter-release development versions will include an additional ".9999" suffix.
116127
* `epi_slide` and `epix_slide` now raise an error rather than silently filtering
117128
out `ref_time_values` that don't meet their expectations.
118129

119-
## New features:
130+
## New features
120131

121132
* `epix_slide`, `<epi_archive>$slide` have a new parameter `all_versions`. With
122133
`all_versions=TRUE`, `epix_slide` will pass a filtered `epi_archive` to each
123134
computation rather than an `epi_df` snapshot. This enables, e.g., performing
124135
pseudoprospective forecasts with a revision-aware forecaster using nested
125136
`epix_slide` operations.
126137

127-
## Improvements:
138+
## Improvements
128139

129140
* Added `dplyr::group_by` and `dplyr::ungroup` S3 methods for `epi_archive`
130141
objects, plus corresponding `$group_by` and `$ungroup` R6 methods. The
@@ -134,35 +145,35 @@ inter-release development versions will include an additional ".9999" suffix.
134145
requirement (part of
135146
[#154](https://github.com/cmu-delphi/epiprocess/issues/154)).
136147

137-
## Cleanup:
148+
## Cleanup
138149

139150
* Added a `NEWS.md` file to track changes to the package.
140151
* Implemented `?dplyr::dplyr_extending` for `epi_df`s
141152
([#223](https://github.com/cmu-delphi/epiprocess/issues/223)).
142153
* Fixed various small documentation issues ([#217](https://github.com/cmu-delphi/epiprocess/issues/217)).
143154

144-
# epiprocess 0.5.0:
155+
# epiprocess 0.5.0
145156

146-
## Potentially-breaking changes:
157+
## Potentially-breaking changes
147158

148159
* `epix_slide`, `<epi_archive>$slide` now feed `f` an `epi_df` rather than
149160
converting to a tibble/`tbl_df` first, allowing use of `epi_df` methods and
150161
metadata, and often yielding `epi_df`s out of the slide as a result. To obtain
151162
the old behavior, convert to a tibble within `f`.
152163

153-
## Improvements:
164+
## Improvements
154165

155166
* Fixed `epix_merge`, `<epi_archive>$merge` always raising error on `sync="truncate"`.
156167

157-
## Cleanup:
168+
## Cleanup
158169

159170
* Added `Remotes:` entry for `genlasso`, which was removed from CRAN.
160171
* Added `as_epi_archive` tests.
161172
* Added missing `epix_merge` test for `sync="truncate"`.
162173

163-
# epiprocess 0.4.0:
174+
# epiprocess 0.4.0
164175

165-
## Potentially-breaking changes:
176+
## Potentially-breaking changes
166177

167178
* Fixed `[.epi_df` to not reorder columns, which was incompatible with
168179
downstream packages.
@@ -177,20 +188,20 @@ inter-release development versions will include an additional ".9999" suffix.
177188
* Fixed `[.epi_df` to drop metadata if decaying to a tibble (due to removal
178189
of essential columns).
179190

180-
## Improvements:
191+
## Improvements
181192

182193
* Added check that `epi_df` `additional_metadata` is list.
183194
* Fixed some incorrect `as_epi_df` examples.
184195

185-
## Cleanup:
196+
## Cleanup
186197

187198
* Applied rename of upstream package in examples: `delphi.epidata` ->
188199
`epidatr`.
189200
* Rounded out `[.epi_df` tests.
190201

191-
# epiprocess 0.3.0:
202+
# epiprocess 0.3.0
192203

193-
## Breaking changes:
204+
## Breaking changes
194205

195206
* `as_epi_archive`, `epi_archive$new`:
196207
* Compactification (see below) by default may change results if working
@@ -223,7 +234,7 @@ inter-release development versions will include an additional ".9999" suffix.
223234
reporting latency, `n=7` will *not* yield 7 days of data in a typical
224235
daily-reporting surveillance data source, as one might have assumed).
225236

226-
## New features:
237+
## New features
227238

228239
* `as_epi_archive`, `epi_archive$new`:
229240
* New `compactify` parameter allows removal of rows that are redundant for the
@@ -248,20 +259,20 @@ inter-release development versions will include an additional ".9999" suffix.
248259
`epi_archive` rather than an outdated R6 implementation from whenever the
249260
data object was generated.
250261

251-
# epiprocess 0.2.0:
262+
# epiprocess 0.2.0
252263

253-
## Breaking changes:
264+
## Breaking changes
254265

255266
* Removed default `n=7` argument to `epix_slide`.
256267

257-
## Improvements:
268+
## Improvements
258269

259270
* Ignore `NA`s when printing `time_value` range for an `epi_archive`.
260271
* Fixed misleading column naming in `epix_slide` example.
261272
* Trimmed down `epi_slide` examples.
262273
* Synced out-of-date docs.
263274

264-
## Cleanup:
275+
## Cleanup
265276

266277
* Removed dependency of some `epi_archive` tests on an example archive.
267278
object, and made them more understandable by reading without running.
@@ -271,16 +282,16 @@ inter-release development versions will include an additional ".9999" suffix.
271282
* Removed some dead code.
272283
* Made `.{Rbuild,git}ignore` files more comprehensive.
273284

274-
# epiprocess 0.1.2:
285+
# epiprocess 0.1.2
275286

276-
## New features:
287+
## New features
277288

278289
* New `new_epi_df` function is similar to `as_epi_df`, but (i) recalculates,
279290
overwrites, and/or drops most metadata of `x` if it has any, (ii) may
280291
still reorder the columns of `x` even if it's already an `epi_df`, and
281292
(iii) treats `x` as optional, constructing an empty `epi_df` by default.
282293

283-
## Improvements:
294+
## Improvements
284295

285296
* Fixed `geo_type` guessing on alphabetical strings with more than 2
286297
characters to yield `"custom"`, not US `"nation"`.
@@ -300,20 +311,20 @@ inter-release development versions will include an additional ".9999" suffix.
300311
* Improved `as_epi_archive` and `epi_archive$new`/`$initialize`
301312
documentation, including constructing a toy archive.
302313

303-
## Cleanup:
314+
## Cleanup
304315

305316
* Added tests for `epi_slide`, `epi_cor`, and internal utility functions.
306317
* Fixed currently-unused internal utility functions `MiddleL`, `MiddleR` to
307318
yield correct results on odd-length vectors.
308319

309-
# epiprocess 0.1.1:
320+
# epiprocess 0.1.1
310321

311-
## New features:
322+
## New features
312323

313324
* New example data objects allow one to quickly experiment with `epi_df`s
314325
and `epi_archives` without relying/waiting on an API to fetch data.
315326

316-
## Improvements:
327+
## Improvements
317328

318329
* Improved `epi_slide` error messaging.
319330
* Fixed description of the appropriate parameters for an `f` argument to
@@ -322,61 +333,60 @@ inter-release development versions will include an additional ".9999" suffix.
322333
* Added some examples throughout the package.
323334
* Using example data objects in vignettes also speeds up vignette compilation.
324335

325-
## Cleanup:
336+
## Cleanup
326337

327338
* Set up gh-actions CI.
328339
* Added tests for `epi_df`s.
329340

330341
# epiprocess 0.1.0
331342

332-
## Implemented core functionality, vignettes:
333-
334-
Classes:
335-
* `epi_df`: specialized `tbl_df` for geotemporal epidemiological time
336-
series data, with optional metadata recording other key columns (e.g.,
337-
demographic breakdowns) and `as_of` what time/version this data was
338-
current/published. Associated functions:
339-
* `as_epi_df` converts to an `epi_df`, guessing the `geo_type`,
340-
`time_type`, `other_keys`, and `as_of` if not specified.
341-
* `as_epi_df.tbl_ts` and `as_tsibble.epi_df` automatically set
342-
`other_keys` and `key`&`index`, respectively.
343-
* `epi_slide` applies a user-supplied computation to a sliding/rolling
344-
time window and user-specified groups, adding the results as new
345-
columns, and recycling/broadcasting results to keep the result size
346-
stable. Allows computation to be provided as a function, `purrr`-style
347-
formula, or tidyeval dots. Uses `slider` underneath for efficiency.
348-
* `epi_cor` calculates Pearson, Kendall, or Spearman correlations
349-
between two (optionally time-shifted) variables in an `epi_df` within
350-
user-specified groups.
351-
* Convenience function: `is_epi_df`.
352-
* `epi_archive`: R6 class for version (patch) data for geotemporal
353-
epidemiological time series data sets. Comes with S3 methods and regular
354-
functions that wrap around this functionality for those unfamiliar with R6
355-
methods. Associated functions:
356-
* `as_epi_archive`: prepares an `epi_archive` object from a data frame
357-
containing snapshots and/or patch data for every available version of
358-
the data set.
359-
* `as_of`: extracts a snapshot of the data set as of some requested
360-
version, in `epi_df` format.
361-
* `epix_slide`, `<epi_archive>$slide`: similar to `epi_slide`, but for
362-
`epi_archive`s; for each requested `ref_time_value` and group, applies
363-
a time window and user-specified computation to a snapshot of the data
364-
as of `ref_time_value`.
365-
* `epix_merge`, `<epi_archive>$merge`: like `merge` for `epi_archive`s,
366-
but allowing for the last version of each observation to be carried
367-
forward to fill in gaps in `x` or `y`.
368-
* Convenience function: `is_epi_archive`.
369-
370-
Additional functions:
371-
* `growth_rate`: estimates growth rate of a time series using one of a few
372-
built-in `method`s based on relative change, linear regression,
373-
smoothing splines, or trend filtering.
374-
* `detect_outlr`: applies one or more outlier detection methods to a given
375-
signal variable, and optionally aggregates the outputs to create a
376-
consensus result.
377-
* `detect_outlr_rm`: outlier detection function based on a
378-
rolling-median-based outlier detection function; one of the methods
379-
included in `detect_outlr`.
380-
* `detect_outlr_stl`: outlier detection function based on a seasonal-trend
381-
decomposition using LOESS (STL); one of the methods included in
382-
`detect_outlr`.
343+
## Implemented core functionality, vignettes
344+
345+
* Classes:
346+
* `epi_df`: specialized `tbl_df` for geotemporal epidemiological time
347+
series data, with optional metadata recording other key columns (e.g.,
348+
demographic breakdowns) and `as_of` what time/version this data was
349+
current/published. Associated functions:
350+
* `as_epi_df` converts to an `epi_df`, guessing the `geo_type`,
351+
`time_type`, `other_keys`, and `as_of` if not specified.
352+
* `as_epi_df.tbl_ts` and `as_tsibble.epi_df` automatically set
353+
`other_keys` and `key`&`index`, respectively.
354+
* `epi_slide` applies a user-supplied computation to a sliding/rolling
355+
time window and user-specified groups, adding the results as new
356+
columns, and recycling/broadcasting results to keep the result size
357+
stable. Allows computation to be provided as a function, `purrr`-style
358+
formula, or tidyeval dots. Uses `slider` underneath for efficiency.
359+
* `epi_cor` calculates Pearson, Kendall, or Spearman correlations
360+
between two (optionally time-shifted) variables in an `epi_df` within
361+
user-specified groups.
362+
* Convenience function: `is_epi_df`.
363+
* `epi_archive`: R6 class for version (patch) data for geotemporal
364+
epidemiological time series data sets. Comes with S3 methods and regular
365+
functions that wrap around this functionality for those unfamiliar with R6
366+
methods. Associated functions:
367+
* `as_epi_archive`: prepares an `epi_archive` object from a data frame
368+
containing snapshots and/or patch data for every available version of
369+
the data set.
370+
* `as_of`: extracts a snapshot of the data set as of some requested
371+
version, in `epi_df` format.
372+
* `epix_slide`, `<epi_archive>$slide`: similar to `epi_slide`, but for
373+
`epi_archive`s; for each requested `ref_time_value` and group, applies
374+
a time window and user-specified computation to a snapshot of the data
375+
as of `ref_time_value`.
376+
* `epix_merge`, `<epi_archive>$merge`: like `merge` for `epi_archive`s,
377+
but allowing for the last version of each observation to be carried
378+
forward to fill in gaps in `x` or `y`.
379+
* Convenience function: `is_epi_archive`.
380+
* Additional functions:
381+
* `growth_rate`: estimates growth rate of a time series using one of a few
382+
built-in `method`s based on relative change, linear regression,
383+
smoothing splines, or trend filtering.
384+
* `detect_outlr`: applies one or more outlier detection methods to a given
385+
signal variable, and optionally aggregates the outputs to create a
386+
consensus result.
387+
* `detect_outlr_rm`: outlier detection function based on a
388+
rolling-median-based outlier detection function; one of the methods
389+
included in `detect_outlr`.
390+
* `detect_outlr_stl`: outlier detection function based on a seasonal-trend
391+
decomposition using LOESS (STL); one of the methods included in
392+
`detect_outlr`.

R/archive.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,10 @@ epi_archive =
495495
version <= max_version, ] %>%
496496
unique(by = c("geo_value", "time_value", other_keys),
497497
fromLast = TRUE) %>%
498-
tibble::as_tibble() %>%
498+
tibble::as_tibble() %>%
499+
# (`as_tibble` should de-alias the DT and its columns in any edge
500+
# cases where they are aliased. We don't say we guarantee this
501+
# though.)
499502
dplyr::select(-"version") %>%
500503
as_epi_df(geo_type = self$geo_type,
501504
time_type = self$time_type,

0 commit comments

Comments
 (0)