-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix plotting with updated scoringutils (#89)
* Xadd linting * update Rbuildignore * fix plotting with updated scoringutils * update docs * add a simple test for plot_compare_timeseries + fix use of .dots in group_by * deal with size depreciation in line geoms * fix final depreciation warning * fix linting issues * add pick to namespace --------- Co-authored-by: Sam <[email protected]>
- Loading branch information
Showing
8 changed files
with
71 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
^_pkgdown\.yml$ | ||
^pkgdown$ | ||
^.lintr$ | ||
^codecov\.yml$ | ||
^codecov\.yml$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,3 @@ linters: linters_with_tags( | |
todo_comment_linter = NULL, | ||
function_argument_linter = NULL | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
test_that("plot_compare_timeseries produces expected output", { | ||
obs_rts <- EpiSoon::example_obs_rts %>% | ||
dplyr::mutate(timeseries = "Region 1") %>% | ||
dplyr::bind_rows(EpiSoon::example_obs_rts %>% | ||
dplyr::mutate(timeseries = "Region 2")) | ||
|
||
obs_cases <- EpiSoon::example_obs_cases %>% | ||
dplyr::mutate(timeseries = "Region 1") %>% | ||
dplyr::bind_rows(EpiSoon::example_obs_cases %>% | ||
dplyr::mutate(timeseries = "Region 2")) | ||
|
||
models <- list( | ||
"AR 3" = function(...) { | ||
EpiSoon::bsts_model(model = function(ss, y) { | ||
bsts::AddAr(ss, y = y, lags = 3) | ||
}, ...) | ||
}, | ||
"Semi-local linear trend" = function(...) { | ||
EpiSoon::bsts_model(model = function(ss, y) { | ||
bsts::AddSemilocalLinearTrend(ss, y = y) | ||
}, ...) | ||
} | ||
) | ||
|
||
forecast_eval <- | ||
compare_timeseries(obs_rts, obs_cases, models, | ||
horizon = 10, samples = 10, | ||
serial_interval = EpiSoon::example_serial_interval | ||
) | ||
|
||
p <- plot_compare_timeseries(forecast_eval) | ||
expect_length(p, 8) | ||
purrr::walk(p, function(x) { | ||
expect_s3_class(x, c("gg", "ggplot")) | ||
expect_silent(plot(x)) | ||
}) | ||
}) |