Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a specialized function for calculating rolling averages #400

Merged
merged 52 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
949bf17
initial version of mean-specific epi_slide
nmdefries Jan 17, 2024
4ea9bf7
adding leading/lagging pad dates
nmdefries Jan 18, 2024
521268b
handle `after`; reformat to `slide_one_grp` format
nmdefries Jan 18, 2024
c133614
param checks
nmdefries Jan 18, 2024
73926f3
filter to ref_time_values passed by user before and after computation
nmdefries Jan 22, 2024
42757f5
replace results with NA if `all_rows`; make sure output is epi_df
nmdefries Jan 22, 2024
71a5ac3
don't need to pre-filter for user-provided ref time values
nmdefries Jan 23, 2024
1a0741d
warn that as_list_col not supported
nmdefries Jan 22, 2024
a51e7ee
support list col output
nmdefries Jan 23, 2024
93830c4
support different time_step types
nmdefries Jan 18, 2024
6fd21ee
use more precise way to generate all_dates; comment cleanup
nmdefries Jan 30, 2024
58b8163
fix epi_slide_mean examples
nmdefries Jan 30, 2024
173ea58
pkgdown site
nmdefries Jan 31, 2024
2e49a95
leave epi_slide_mean result grouped
nmdefries Jan 31, 2024
2cc3227
error if any group has duplicate time values
nmdefries Jan 31, 2024
a3efaeb
tests
nmdefries Feb 1, 2024
03a1577
test unmappable types
nmdefries Feb 1, 2024
a243879
compare differnt before/after results
nmdefries Feb 1, 2024
02db0ed
Merge branch 'dev' into ndefries/specialized-slide-mean
nmdefries Feb 6, 2024
007438d
use reclass fn
nmdefries Feb 7, 2024
7d1e1c7
check col name length
nmdefries Feb 7, 2024
a54061a
check that time_step is a function
nmdefries Feb 7, 2024
b548a73
check col name length based on desired name construction
nmdefries Feb 7, 2024
a429145
move full date seq generation to func and test
nmdefries Feb 8, 2024
5fa8aa0
bump version, news
nmdefries Feb 8, 2024
4bf2a29
fix pad date generation when time_step is missing
nmdefries Feb 8, 2024
b7326ba
Merge branch 'dev' into ndefries/specialized-slide-mean
nmdefries Feb 8, 2024
4e10a2b
use cli_* instead of Abort and Warn
nmdefries Feb 8, 2024
18f5e61
test behavior of time_type week with no `time_step`
nmdefries Feb 9, 2024
9982a49
Clarify doc names
nmdefries Mar 6, 2024
ef332d3
bullet formatting in docs
nmdefries Mar 6, 2024
6865039
pluralize col_name args
nmdefries Mar 6, 2024
12c32f0
rename missing dates to times
nmdefries Mar 6, 2024
fe81d2f
rename col_name -> names in tests
nmdefries Mar 6, 2024
862f112
Revert "support list col output"
nmdefries Mar 6, 2024
396df53
expect error when as_list_col is used in epi_slide_mean
nmdefries Mar 6, 2024
8370a1b
clean up examples for epi_slide and _mean
nmdefries Mar 6, 2024
4c9e632
comment use of non-time_step-transformed before/after in full_date_seq
nmdefries Mar 6, 2024
5f3af61
fail if time_values are unevenly spaced
nmdefries Mar 6, 2024
4081485
test cleanup
nmdefries Mar 6, 2024
ed231a9
add epi_slide_mean example to intro slide vignette
nmdefries Mar 13, 2024
fe35331
deprecate more as_list_col behavior, clarify naming error
nmdefries Mar 13, 2024
75a2847
Merge branch 'dev' into ndefries/specialized-slide-mean
nmdefries Mar 13, 2024
bf98cfd
replace deprecated Start and End
nmdefries Mar 14, 2024
298be50
linting
nmdefries Mar 13, 2024
b447484
rearrange test vars for clarity
nmdefries Mar 20, 2024
f5d7a8f
add actionable example to duplicate time value error
nmdefries Mar 20, 2024
c04b2ad
check other before/after values for full_date_seq helper
nmdefries Mar 20, 2024
c6ee7f9
check 0-row input data in epi_slide_mean
nmdefries Mar 21, 2024
56bed8c
support col_names as tidyselect
nmdefries Mar 23, 2024
0125bee
more descriptive frollmean window size name
nmdefries Mar 26, 2024
8ae9fba
style: styler (GHA)
nmdefries Mar 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: epiprocess
Title: Tools for basic signal processing in epidemiology
Version: 0.7.5
Version: 0.7.6
Authors@R: c(
person("Jacob", "Bien", role = "ctb"),
person("Logan", "Brooks", role = "aut"),
Expand Down
7 changes: 7 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export(detect_outlr_stl)
export(epi_archive)
export(epi_cor)
export(epi_slide)
export(epi_slide_mean)
export(epix_as_of)
export(epix_merge)
export(epix_slide)
Expand Down Expand Up @@ -74,6 +75,7 @@ importFrom(checkmate,assert)
importFrom(checkmate,assert_character)
importFrom(checkmate,assert_class)
importFrom(checkmate,assert_data_frame)
importFrom(checkmate,assert_function)
importFrom(checkmate,assert_int)
importFrom(checkmate,assert_list)
importFrom(checkmate,assert_logical)
Expand All @@ -92,11 +94,13 @@ importFrom(data.table,address)
importFrom(data.table,as.data.table)
importFrom(data.table,between)
importFrom(data.table,copy)
importFrom(data.table,frollmean)
importFrom(data.table,key)
importFrom(data.table,rbindlist)
importFrom(data.table,set)
importFrom(data.table,setDF)
importFrom(data.table,setkeyv)
importFrom(dplyr,"%>%")
importFrom(dplyr,arrange)
importFrom(dplyr,bind_rows)
importFrom(dplyr,dplyr_col_modify)
Expand All @@ -113,11 +117,14 @@ importFrom(dplyr,relocate)
importFrom(dplyr,rename)
importFrom(dplyr,select)
importFrom(dplyr,slice)
importFrom(dplyr,tibble)
importFrom(dplyr,ungroup)
importFrom(ggplot2,autoplot)
importFrom(lubridate,as.period)
importFrom(lubridate,days)
importFrom(lubridate,weeks)
importFrom(magrittr,"%>%")
importFrom(purrr,map)
importFrom(purrr,map_lgl)
importFrom(rlang,"!!!")
importFrom(rlang,"!!")
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Pre-1.0.0 numbering scheme: 0.x will indicate releases, while 0.x.y will indicat
- `epi_slide` computations are now 2-4 times faster after changing how
reference time values, made accessible within sliding functions, are
calculated (#397).
- Add new `epi_slide_mean` function to allow much (~30x) faster rolling
average computations in some cases (#400).
- regenerated the `jhu_csse_daily_subset` dataset with the latest versions of
the data from the API
- changed approach to versioning, see DEVELOPMENT.md for details
Expand Down
401 changes: 401 additions & 0 deletions R/slide.R

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ reference:
desc: Functions that act on `epi_df` objects.
- contents:
- epi_slide
- epi_slide_mean
- epi_cor
- title: Vector functions
desc: Functions that act directly on signal variables.
Expand Down
9 changes: 6 additions & 3 deletions man/autoplot.epi_df.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/epi_slide.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

163 changes: 163 additions & 0 deletions man/epi_slide_mean.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/epiprocess.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading