Skip to content

Commit 5436aa3

Browse files
authored
Merge pull request #311 from cmu-delphi/lcb/make_epix_slide_more_like_reframe
Make `epix_slide` more like `group_modify`
2 parents d7f3521 + 116bae0 commit 5436aa3

25 files changed

+1056
-367
lines changed

.github/workflows/R-CMD-check.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master]
7+
branches: [main, master, dev]
88

99
name: R-CMD-check
1010

.github/workflows/pkgdown.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master]
7+
branches: [main, master, dev]
88
release:
99
types: [published]
1010
workflow_dispatch:

DESCRIPTION

+2-2
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.6.0
4+
Version: 0.6.0.9999
55
Authors@R: c(
66
person("Jacob", "Bien", role = "ctb"),
77
person("Logan", "Brooks", role = "aut"),
@@ -62,7 +62,7 @@ Config/testthat/edition: 3
6262
Encoding: UTF-8
6363
LazyData: true
6464
Roxygen: list(markdown = TRUE)
65-
RoxygenNote: 7.2.1
65+
RoxygenNote: 7.2.3
6666
Depends:
6767
R (>= 2.10)
6868
URL: https://cmu-delphi.github.io/epiprocess/

NAMESPACE

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ S3method(as_epi_df,data.frame)
66
S3method(as_epi_df,epi_df)
77
S3method(as_epi_df,tbl_df)
88
S3method(as_epi_df,tbl_ts)
9+
S3method(as_tibble,epi_df)
910
S3method(as_tsibble,epi_df)
1011
S3method(dplyr_col_modify,col_modify_recorder_df)
1112
S3method(dplyr_col_modify,epi_df)
@@ -17,6 +18,7 @@ S3method(group_by,epi_archive)
1718
S3method(group_by,epi_df)
1819
S3method(group_by,grouped_epi_archive)
1920
S3method(group_by_drop_default,grouped_epi_archive)
21+
S3method(group_modify,epi_df)
2022
S3method(groups,grouped_epi_archive)
2123
S3method(next_after,Date)
2224
S3method(next_after,integer)
@@ -99,6 +101,7 @@ importFrom(rlang,sym)
99101
importFrom(rlang,syms)
100102
importFrom(stats,cor)
101103
importFrom(stats,median)
104+
importFrom(tibble,as_tibble)
102105
importFrom(tidyr,unnest)
103106
importFrom(tidyselect,eval_select)
104107
importFrom(tidyselect,starts_with)

NEWS.md

+31
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ Note that `epiprocess` uses the [Semantic Versioning
44
("semver")](https://semver.org/) scheme for all release versions, but any
55
inter-release development versions will include an additional ".9999" suffix.
66

7+
## Breaking changes:
8+
9+
* `epix_slide` has been made more like `dplyr::group_modify`. It will no longer
10+
perform element/row recycling for size stability, accepts slide computation
11+
outputs containing any number of rows, and no longer supports `all_rows`.
12+
* To keep the old behavior, manually perform row recycling within `f`
13+
computations, and/or `left_join` a data frame representing the desired
14+
output structure with the current `epix_slide()` result to obtain the
15+
desired repetitions and completions expected with `all_rows = TRUE`.
16+
* `epix_slide` will only output grouped or ungrouped tibbles. Previously, it
17+
would sometimes output `epi_df`s, but not consistently, and not always with
18+
the metadata desired. Future versions will revisit this design, and consider
19+
more closely whether/when/how to output an `epi_df`.
20+
* To keep the old behavior, convert the output of `epix_slide()` to `epi_df`
21+
when desired and set the metadata appropriately.
22+
23+
## Improvements:
24+
25+
* `epi_slide` and `epix_slide` now support `as_list_col = TRUE` when the slide
26+
computations output atomic vectors, and output a list column in "chopped"
27+
format (see `tidyr::chop`).
28+
* `epi_slide` now works properly with slide computations that output just a
29+
`Date` vector, rather than converting `slide_value` to a numeric column.
30+
731
# epiprocess 0.6.0
832

933
## Breaking changes:
@@ -23,6 +47,13 @@ inter-release development versions will include an additional ".9999" suffix.
2347
* Slide functions now keep any grouping of `x` in their results, like
2448
`mutate` and `group_modify`.
2549
* To obtain the old behavior, `dplyr::ungroup` the slide results immediately.
50+
* Additional `epi_slide` changes:
51+
* When using `as_list_col = TRUE` together with `ref_time_values` and
52+
`all_rows=TRUE`, the marker for excluded computations is now a `NULL` entry
53+
in the list column, rather than a `NA`; if you are using `tidyr::unnest()`
54+
afterward and want to keep these missing data markers, you will need to
55+
replace the `NULL` entries with `NA`s. Skipped computations are now more
56+
uniformly detectable using `vctrs` methods.
2657
* Additional`epix_slide` changes:
2758
* `epix_slide`'s `group_by` argument has been replaced by `dplyr::group_by` and
2859
`dplyr::ungroup` S3 methods. The `group_by` method uses "data masking" (also

R/archive.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ epi_archive =
307307
Abort("compactify must be boolean or null.")
308308
}
309309

310-
# Apply defaults and conduct checks and apply defaults for
310+
# Apply defaults and conduct checks for
311311
# `clobberable_versions_start`, `versions_end`:
312312
if (missing(clobberable_versions_start)) {
313313
clobberable_versions_start <- NA
@@ -640,7 +640,7 @@ epi_archive =
640640
slide = function(f, ..., before, ref_time_values,
641641
time_step, new_col_name = "slide_value",
642642
as_list_col = FALSE, names_sep = "_",
643-
all_rows = FALSE, all_versions = FALSE) {
643+
all_versions = FALSE) {
644644
# For an "ungrouped" slide, treat all rows as belonging to one big
645645
# group (group by 0 vars), like `dplyr::summarize`, and let the
646646
# resulting `grouped_epi_archive` handle the slide:
@@ -649,7 +649,7 @@ epi_archive =
649649
before = before, ref_time_values = ref_time_values,
650650
time_step = time_step, new_col_name = new_col_name,
651651
as_list_col = as_list_col, names_sep = names_sep,
652-
all_rows = all_rows, all_versions = all_versions
652+
all_versions = all_versions
653653
) %>%
654654
# We want a slide on ungrouped archives to output something
655655
# ungrouped, rather than retaining the trivial (0-variable)

0 commit comments

Comments
 (0)