Skip to content

Commit eec777f

Browse files
authored
Merge pull request #431 from cmu-delphi/ds/r6-clean
wip feat: replace R6 `epi_archive` with S3 implementation
2 parents 4e65e51 + e61e11a commit eec777f

Some content is hidden

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

45 files changed

+1658
-2480
lines changed

DESCRIPTION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Imports:
3939
lubridate,
4040
magrittr,
4141
purrr,
42-
R6,
4342
rlang,
4443
slider,
4544
tibble,
@@ -50,12 +49,12 @@ Imports:
5049
vctrs
5150
Suggests:
5251
covidcast,
52+
devtools,
5353
epidatr,
5454
knitr,
5555
outbreaks,
5656
rmarkdown,
5757
testthat (>= 3.1.5),
58-
waldo (>= 0.3.1),
5958
withr
6059
VignetteBuilder:
6160
knitr

NAMESPACE

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ S3method(as_epi_df,tbl_ts)
99
S3method(as_tibble,epi_df)
1010
S3method(as_tsibble,epi_df)
1111
S3method(autoplot,epi_df)
12+
S3method(clone,epi_archive)
13+
S3method(clone,grouped_epi_archive)
1214
S3method(dplyr_col_modify,col_modify_recorder_df)
1315
S3method(dplyr_col_modify,epi_df)
1416
S3method(dplyr_reconstruct,epi_df)
1517
S3method(dplyr_row_slice,epi_df)
18+
S3method(epix_slide,epi_archive)
19+
S3method(epix_slide,grouped_epi_archive)
1620
S3method(epix_truncate_versions_after,epi_archive)
1721
S3method(epix_truncate_versions_after,grouped_epi_archive)
1822
S3method(group_by,epi_archive)
@@ -27,7 +31,9 @@ S3method(key_colnames,epi_archive)
2731
S3method(key_colnames,epi_df)
2832
S3method(next_after,Date)
2933
S3method(next_after,integer)
34+
S3method(print,epi_archive)
3035
S3method(print,epi_df)
36+
S3method(print,grouped_epi_archive)
3137
S3method(select,epi_df)
3238
S3method(summary,epi_df)
3339
S3method(ungroup,epi_df)
@@ -40,37 +46,38 @@ export(as_epi_archive)
4046
export(as_epi_df)
4147
export(as_tsibble)
4248
export(autoplot)
49+
export(clone)
4350
export(detect_outlr)
4451
export(detect_outlr_rm)
4552
export(detect_outlr_stl)
46-
export(epi_archive)
4753
export(epi_cor)
4854
export(epi_slide)
4955
export(epi_slide_mean)
5056
export(epi_slide_opt)
5157
export(epi_slide_sum)
5258
export(epix_as_of)
59+
export(epix_fill_through_version)
5360
export(epix_merge)
5461
export(epix_slide)
5562
export(epix_truncate_versions_after)
5663
export(filter)
5764
export(group_by)
5865
export(group_modify)
5966
export(growth_rate)
60-
export(is_epi_archive)
6167
export(is_epi_df)
6268
export(is_grouped_epi_archive)
6369
export(key_colnames)
6470
export(max_version_with_row_in)
6571
export(mutate)
72+
export(new_epi_archive)
6673
export(new_epi_df)
6774
export(next_after)
6875
export(relocate)
6976
export(rename)
7077
export(slice)
7178
export(ungroup)
7279
export(unnest)
73-
importFrom(R6,R6Class)
80+
export(validate_epi_archive)
7481
importFrom(checkmate,anyInfinite)
7582
importFrom(checkmate,anyMissing)
7683
importFrom(checkmate,assert)
@@ -86,12 +93,16 @@ importFrom(checkmate,assert_scalar)
8693
importFrom(checkmate,checkInt)
8794
importFrom(checkmate,check_atomic)
8895
importFrom(checkmate,check_data_frame)
96+
importFrom(checkmate,check_names)
97+
importFrom(checkmate,expect_class)
8998
importFrom(checkmate,test_set_equal)
9099
importFrom(checkmate,test_subset)
91100
importFrom(checkmate,vname)
101+
importFrom(cli,cat_line)
92102
importFrom(cli,cli_abort)
93-
importFrom(cli,cli_inform)
103+
importFrom(cli,cli_vec)
94104
importFrom(cli,cli_warn)
105+
importFrom(cli,format_message)
95106
importFrom(data.table,":=")
96107
importFrom(data.table,address)
97108
importFrom(data.table,as.data.table)
@@ -111,12 +122,15 @@ importFrom(dplyr,bind_rows)
111122
importFrom(dplyr,dplyr_col_modify)
112123
importFrom(dplyr,dplyr_reconstruct)
113124
importFrom(dplyr,dplyr_row_slice)
125+
importFrom(dplyr,everything)
114126
importFrom(dplyr,filter)
115127
importFrom(dplyr,group_by)
116128
importFrom(dplyr,group_by_drop_default)
117129
importFrom(dplyr,group_modify)
118130
importFrom(dplyr,group_vars)
119131
importFrom(dplyr,groups)
132+
importFrom(dplyr,if_all)
133+
importFrom(dplyr,if_any)
120134
importFrom(dplyr,mutate)
121135
importFrom(dplyr,relocate)
122136
importFrom(dplyr,rename)
@@ -133,12 +147,14 @@ importFrom(purrr,map)
133147
importFrom(purrr,map_lgl)
134148
importFrom(rlang,"!!!")
135149
importFrom(rlang,"!!")
150+
importFrom(rlang,"%||%")
136151
importFrom(rlang,.data)
137152
importFrom(rlang,.env)
138153
importFrom(rlang,arg_match)
139154
importFrom(rlang,as_label)
140155
importFrom(rlang,caller_arg)
141156
importFrom(rlang,caller_env)
157+
importFrom(rlang,check_dots_empty)
142158
importFrom(rlang,enquo)
143159
importFrom(rlang,enquos)
144160
importFrom(rlang,env)

NEWS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.x.y will indicat
3232
## Breaking changes
3333

3434
- Switched `epi_df`'s `other_keys` default from `NULL` to `character(0)`; PR #390
35+
- Refactored `epi_archive` to use S3 instead of R6 for its object model. The
36+
functionality stay the same, but it will break the member function interface.
37+
For migration, you can usually just convert `epi_archive$merge(...)` to
38+
`epi_archive <- epi_archive %>% epix_merge(...)` (and the same for
39+
`fill_through_version` and `truncate_after_version`) and
40+
`epi_archive$slide(...)` to `epi_archive %>% epix_slide(...)` (and the same
41+
for `as_of`, `group_by`, `slide`, etc.) (#340). In some limited situations,
42+
such as if you have a helper function that calls `epi_archive$merge` etc. on
43+
one of its arguments, then you may need to more carefully refactor them.
3544

3645
# epiprocess 0.7.0
3746

0 commit comments

Comments
 (0)