Skip to content

Commit 02d4d26

Browse files
committed
Update + skip forecast archive tests until other updates in
1 parent b2a9860 commit 02d4d26

File tree

4 files changed

+38
-21
lines changed

4 files changed

+38
-21
lines changed

DESCRIPTION

+1-1
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.11.0
4+
Version: 0.11.1
55
Authors@R: c(
66
person("Jacob", "Bien", role = "ctb"),
77
person("Logan", "Brooks", , "[email protected]", role = c("aut", "cre")),

R/utils.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ format_chr_deparse <- function(x) {
111111
#' @examples
112112
#' cli::cli_inform('{format_chr_with_quotes("x")}')
113113
#' cli::cli_inform('{format_chr_with_quotes(c("x","y"))}')
114-
#' nms <- c("x","\"Total Cases\"")
115-
#' cli::cli_inform('{format_chr_with_quotes(nms)}')
116-
#' cli::cli_inform('{format_chr_with_quotes(character())}')
114+
#' nms <- c("x", "\"Total Cases\"")
115+
#' cli::cli_inform("{format_chr_with_quotes(nms)}")
116+
#' cli::cli_inform("{format_chr_with_quotes(character())}")
117117
#'
118118
#' @keywords internal
119119
format_chr_with_quotes <- function(x, empty = "*none*") {

man/format_chr_with_quotes.Rd

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-compactify.R

+31-14
Original file line numberDiff line numberDiff line change
@@ -120,37 +120,54 @@ test_that("compactify does not alter the default clobberable and observed versio
120120
expect_identical(ea_true$versions_end, ea_false$versions_end)
121121
})
122122

123+
quantile_pred_once <- function(estimates_vec, levels_vec) {
124+
hardhat::quantile_pred(t(as.matrix(estimates_vec)), levels_vec)
125+
}
123126
test_that("compactify works on distributions", {
127+
skip("Until #611 is merged or hardhat/epipredict is patched")
124128
forecasts <- tibble(
125129
ahead = 2L,
126130
geo_value = "ak",
127131
target_end_date = as.Date("2020-01-19"),
128-
forecast_date = as.Date("2020-01-17") + 1:8,
132+
forecast_date = as.Date("2020-01-17") + 1:6,
129133
actual = 25,
130134
.pred_distn = c(
131-
epipredict::dist_quantiles(c(1, 5, 9), c(0.1, 0.5, 0.9)),
132-
epipredict::dist_quantiles(c(1, NA, 9), c(0.1, 0.5, 0.9)), # single NA in quantiles
133-
epipredict::dist_quantiles(c(NA, NA, NA), c(0.1, 0.5, 0.9)), # all NAs in quantiles
134-
distributional::dist_missing(1), # the actual `NA` for distributions
135-
epipredict::dist_quantiles(c(1, 5, 9), c(0.1, 0.5, 0.9)), # and back
136-
epipredict::dist_quantiles(c(3, 5, 9), c(0.1, 0.5, 0.9)), # change quantile
137-
epipredict::dist_quantiles(c(3, 5, 9), c(0.2, 0.5, 0.8)), # change level
138-
epipredict::dist_quantiles(c(3, 5, 9), c(0.2, 0.5, 0.8)) # LOCF
135+
quantile_pred_once(c(1, 5, 9), c(0.1, 0.5, 0.9)),
136+
quantile_pred_once(c(1, NA, 9), c(0.1, 0.5, 0.9)), # single NA in quantiles
137+
quantile_pred_once(c(NA, NA, NA), c(0.1, 0.5, 0.9)), # all NAs in quantiles (hardhat+vctrs+epipredict treats as missing)
138+
quantile_pred_once(c(1, 5, 9), c(0.1, 0.5, 0.9)), # and back
139+
quantile_pred_once(c(3, 5, 9), c(0.1, 0.5, 0.9)), # change quantile
140+
quantile_pred_once(c(3, 5, 9), c(0.1, 0.5, 0.9)) # LOCF
139141
)
140142
)
141143
expect_equal(
142144
forecasts %>%
143-
as_epi_archive(
144-
other_keys = "ahead", time_value = target_end_date, version = forecast_date,
145-
compactify = TRUE
146-
) %>%
145+
as_epi_archive(other_keys = "ahead", time_value = target_end_date, version = forecast_date) %>%
147146
.$DT %>%
148147
as.data.frame() %>%
149148
as_tibble(),
150-
forecasts[-8, ] %>%
149+
forecasts[-6, ] %>%
151150
rename(time_value = target_end_date, version = forecast_date)
152151
)
153152
})
153+
test_that("epix_merge works with distributions", {
154+
skip("Until hardhat/epipredict is patched")
155+
forecasts1ea <- tibble(
156+
ahead = 2L,
157+
geo_value = "ak",
158+
target_end_date = as.Date("2020-01-19"),
159+
forecast_date = as.Date("2020-01-17") + 1,
160+
.pred_distn1 = quantile_pred_once(c(1, 5, 9), c(0.1, 0.5, 0.9))
161+
) %>% as_epi_archive(other_keys = "ahead", time_value = target_end_date, version = forecast_date)
162+
forecasts2ea <- tibble(
163+
ahead = 2L,
164+
geo_value = "ak",
165+
target_end_date = as.Date("2020-01-19"),
166+
forecast_date = as.Date("2020-01-17") + 2,
167+
.pred_distn2 = quantile_pred_once(c(2, 4, 8), c(0.1, 0.5, 0.9))
168+
) %>% as_epi_archive(other_keys = "ahead", time_value = target_end_date, version = forecast_date)
169+
forecasts12ea <- epix_merge(forecasts1ea, forecasts2ea, sync = "locf")
170+
})
154171

155172
test_that("Large compactify_abs_tol does not drop edf keys", {
156173
# several epikeytimes, each with a single version

0 commit comments

Comments
 (0)