From 0848975aded0af8a6ae8a69b3ee0cfc750b4af12 Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Tue, 28 Nov 2023 13:58:33 +0100 Subject: [PATCH 01/12] Delete old alias for `avail_forecasts()` --- R/available_forecasts.R | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/R/available_forecasts.R b/R/available_forecasts.R index 17418b0a6..e130a7b77 100644 --- a/R/available_forecasts.R +++ b/R/available_forecasts.R @@ -74,19 +74,3 @@ available_forecasts <- function(data, return(out[]) } - -#' @title Count Number of Available Forecasts `r lifecycle::badge("deprecated")` -#' @details `r lifecycle::badge("deprecated")` Deprecated in 1.2.2. Use -#' [available_forecasts()] instead. -#' @inherit available_forecasts -#' @keywords check-forecasts -#' @export -avail_forecasts <- function(data, - by = NULL, - collapse = c("quantile", "sample")) { - lifecycle::deprecate_warn( - "1.2.2", "avail_forecasts()", - "available_forecasts()" - ) - available_forecasts(data, by, collapse) -} From 5b7aa12f49ca26d6828eda58d16e51e8d9cd3d40 Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Tue, 28 Nov 2023 14:00:40 +0100 Subject: [PATCH 02/12] remove `plot_avail_forecasts()` --- R/plot.R | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/R/plot.R b/R/plot.R index 0ec4bb8c1..4f644399c 100644 --- a/R/plot.R +++ b/R/plot.R @@ -1011,44 +1011,6 @@ plot.scoringutils_available_forecasts <- function(x, } -#' @title Visualise Where Forecasts Are Available `r lifecycle::badge("deprecated")` -#' -#' @description -#' Old version of [plot.scoringutils_available_forecasts()] for compatibility. -#' @inheritParams plot.scoringutils_available_forecasts -#' @param available_forecasts an S3 object of class "scoringutils_available_forecasts" -#' as produced by [available_forecasts()] -#' @param y character vector of length one that denotes the name of the column -#' to appear on the y-axis of the plot. Default is "model". -#' @param x character vector of length one that denotes the name of the column -#' to appear on the x-axis of the plot. Default is "forecast_date". -#' @param make_x_factor logical (default is TRUE). Whether or not to convert -#' the variable on the x-axis to a factor. This has an effect e.g. if dates -#' are shown on the x-axis. -#' @export -plot_avail_forecasts <- function(available_forecasts, - y = "model", - x = "forecast_date", - make_x_factor = TRUE, - show_numbers = TRUE) { - - lifecycle::deprecate_warn( - "1.2.2", "plot_avail_forecasts()", - "plot()" - ) - - plot.scoringutils_available_forecasts( - x = available_forecasts, - yvar = y, - xvar = x, - make_xvar_factor = make_x_factor, - show_numbers = show_numbers - ) -} - - - - #' @title Plot Correlation Between Metrics #' #' @description From 8666a521c8147b4cbf7aed08b07e2b3094dc897f Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Tue, 28 Nov 2023 14:11:29 +0100 Subject: [PATCH 03/12] Replace `available_forecasts()` with `get_forecast_counts()` --- NAMESPACE | 6 +-- R/available_forecasts.R | 6 +-- R/plot.R | 18 +++---- R/validate.R | 4 +- man/avail_forecasts.Rd | 47 ------------------- ...le_forecasts.Rd => get_forecast_counts.Rd} | 8 ++-- ...e_forecasts.Rd => plot.forecast_counts.Rd} | 12 ++--- man/plot_avail_forecasts.Rd | 34 -------------- tests/testthat/test-available_forecasts.R | 14 +++--- tests/testthat/test-plot_avail_forecasts.R | 9 ++-- vignettes/scoringutils.Rmd | 8 ++-- 11 files changed, 41 insertions(+), 125 deletions(-) delete mode 100644 man/avail_forecasts.Rd rename man/{available_forecasts.Rd => get_forecast_counts.Rd} (91%) rename man/{plot.scoringutils_available_forecasts.Rd => plot.forecast_counts.Rd} (79%) delete mode 100644 man/plot_avail_forecasts.Rd diff --git a/NAMESPACE b/NAMESPACE index 97d7f8b63..0bd3337ec 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,6 @@ # Generated by roxygen2: do not edit by hand -S3method(plot,scoringutils_available_forecasts) +S3method(plot,forecast_counts) S3method(print,scoringutils_check) S3method(quantile_to_interval,data.frame) S3method(quantile_to_interval,numeric) @@ -19,8 +19,6 @@ export(add_coverage) export(add_pairwise_comparison) export(ae_median_quantile) export(ae_median_sample) -export(avail_forecasts) -export(available_forecasts) export(available_metrics) export(bias_quantile) export(bias_range) @@ -31,6 +29,7 @@ export(crps_sample) export(dispersion) export(dss_sample) export(get_duplicate_forecasts) +export(get_forecast_counts) export(get_forecast_type) export(get_forecast_unit) export(interval_coverage_deviation_quantile) @@ -49,7 +48,6 @@ export(overprediction) export(pairwise_comparison) export(pit) export(pit_sample) -export(plot_avail_forecasts) export(plot_correlation) export(plot_heatmap) export(plot_interval_coverage) diff --git a/R/available_forecasts.R b/R/available_forecasts.R index e130a7b77..9f933f701 100644 --- a/R/available_forecasts.R +++ b/R/available_forecasts.R @@ -31,10 +31,10 @@ #' @examples #' data.table::setDTthreads(1) # only needed to avoid issues on CRAN #' -#' available_forecasts(example_quantile, +#' get_forecast_counts(example_quantile, #' by = c("model", "target_type") #' ) -available_forecasts <- function(data, +get_forecast_counts <- function(data, by = NULL, collapse = c("quantile", "sample_id")) { @@ -70,7 +70,7 @@ available_forecasts <- function(data, out <- merge(out, out_empty, by = by, all.y = TRUE) out[, count := nafill(count, fill = 0)] - class(out) <- c("scoringutils_available_forecasts", class(out)) + class(out) <- c("forecast_counts", class(out)) return(out[]) } diff --git a/R/plot.R b/R/plot.R index 4f644399c..14c5e12b2 100644 --- a/R/plot.R +++ b/R/plot.R @@ -942,8 +942,8 @@ plot_pit <- function(pit, #' @description #' Visualise Where Forecasts Are Available #' @inheritParams print.scoringutils_check -#' @param x an S3 object of class "scoringutils_available_forecasts" -#' as produced by [available_forecasts()] +#' @param x an S3 object of class "forecast_counts" +#' as produced by [get_forecast_counts()] #' @param yvar character vector of length one that denotes the name of the column #' to appear on the y-axis of the plot. Default is "model". #' @param xvar character vector of length one that denotes the name of the column @@ -960,7 +960,7 @@ plot_pit <- function(pit, #' @export #' @examples #' library(ggplot2) -#' available_forecasts <- available_forecasts( +#' available_forecasts <- get_forecast_counts( #' example_quantile, by = c("model", "target_type", "target_end_date") #' ) #' plot( @@ -968,12 +968,12 @@ plot_pit <- function(pit, #' ) + #' facet_wrap("target_type") -plot.scoringutils_available_forecasts <- function(x, - yvar = "model", - xvar = "forecast_date", - make_xvar_factor = TRUE, - show_numbers = TRUE, - ...) { +plot.forecast_counts <- function(x, + yvar = "model", + xvar = "forecast_date", + make_xvar_factor = TRUE, + show_numbers = TRUE, + ...) { x <- as.data.table(x) if (make_xvar_factor) { diff --git a/R/validate.R b/R/validate.R index 5cd246fd0..075abaa0b 100644 --- a/R/validate.R +++ b/R/validate.R @@ -111,7 +111,7 @@ validate.scoringutils_sample <- function(data, ...) { #' - checks there are no duplicate forecasts #' - if appropriate, checks the number of samples / quantiles is the same #' for all forecasts -#' @inheritParams available_forecasts +#' @inheritParams get_forecast_counts #' @return returns the input, with a few new attributes that hold additional #' information, messages and warnings #' @importFrom data.table ':=' is.data.table setattr @@ -162,7 +162,7 @@ validate_general <- function(data) { #' - makes sure that a column called `model` exists and if not creates one #' - assigns a class #' -#' @inheritParams available_forecasts +#' @inheritParams get_forecast_counts #' @param classname name of the class to be created #' @return An object of the class indicated by `classname` #' @export diff --git a/man/avail_forecasts.Rd b/man/avail_forecasts.Rd deleted file mode 100644 index 57d47c5cf..000000000 --- a/man/avail_forecasts.Rd +++ /dev/null @@ -1,47 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/available_forecasts.R -\name{avail_forecasts} -\alias{avail_forecasts} -\title{Count Number of Available Forecasts \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}} -\usage{ -avail_forecasts(data, by = NULL, collapse = c("quantile", "sample")) -} -\arguments{ -\item{data}{A data.frame or data.table with predicted and observed values.} - -\item{by}{character vector or \code{NULL} (the default) that denotes the -categories over which the number of forecasts should be counted. -By default (\code{by = NULL}) this will be the unit of a single forecast (i.e. -all available columns (apart from a few "protected" columns such as -'predicted' and 'observed') plus "quantile" or "sample_id" where present).} - -\item{collapse}{character vector (default is \verb{c("quantile", "sample_id"}) -with names of categories for which the number of rows should be collapsed to -one when counting. For example, a single forecast is usually represented by a -set of several quantiles or samples and collapsing these to one makes sure -that a single forecast only gets counted once. Setting \code{collapse = c()} -would mean that all quantiles / samples would be counted as individual -forecasts.} -} -\value{ -A data.table with columns as specified in \code{by} and an additional -column "count" with the number of forecasts. -} -\description{ -Given a data set with forecasts, count the number of available forecasts -for arbitrary grouping (e.g. the number of forecasts per model, or the -number of forecasts per model and location). -This is useful to determine whether there are any missing forecasts. -} -\details{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Deprecated in 1.2.2. Use -\code{\link[=available_forecasts]{available_forecasts()}} instead. -} -\examples{ -data.table::setDTthreads(1) # only needed to avoid issues on CRAN - -available_forecasts(example_quantile, - by = c("model", "target_type") -) -} -\keyword{check-forecasts} diff --git a/man/available_forecasts.Rd b/man/get_forecast_counts.Rd similarity index 91% rename from man/available_forecasts.Rd rename to man/get_forecast_counts.Rd index 3c214a1e3..1ed71aac7 100644 --- a/man/available_forecasts.Rd +++ b/man/get_forecast_counts.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/available_forecasts.R -\name{available_forecasts} -\alias{available_forecasts} +\name{get_forecast_counts} +\alias{get_forecast_counts} \title{Count Number of Available Forecasts} \usage{ -available_forecasts(data, by = NULL, collapse = c("quantile", "sample_id")) +get_forecast_counts(data, by = NULL, collapse = c("quantile", "sample_id")) } \arguments{ \item{data}{A data.frame or data.table with predicted and observed values.} @@ -36,7 +36,7 @@ This is useful to determine whether there are any missing forecasts. \examples{ data.table::setDTthreads(1) # only needed to avoid issues on CRAN -available_forecasts(example_quantile, +get_forecast_counts(example_quantile, by = c("model", "target_type") ) } diff --git a/man/plot.scoringutils_available_forecasts.Rd b/man/plot.forecast_counts.Rd similarity index 79% rename from man/plot.scoringutils_available_forecasts.Rd rename to man/plot.forecast_counts.Rd index f11e0dc5d..8ace053b4 100644 --- a/man/plot.scoringutils_available_forecasts.Rd +++ b/man/plot.forecast_counts.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/plot.R -\name{plot.scoringutils_available_forecasts} -\alias{plot.scoringutils_available_forecasts} +\name{plot.forecast_counts} +\alias{plot.forecast_counts} \title{Visualise Where Forecasts Are Available} \usage{ -\method{plot}{scoringutils_available_forecasts}( +\method{plot}{forecast_counts}( x, yvar = "model", xvar = "forecast_date", @@ -14,8 +14,8 @@ ) } \arguments{ -\item{x}{an S3 object of class "scoringutils_available_forecasts" -as produced by \code{\link[=available_forecasts]{available_forecasts()}}} +\item{x}{an S3 object of class "forecast_counts" +as produced by \code{\link[=get_forecast_counts]{get_forecast_counts()}}} \item{yvar}{character vector of length one that denotes the name of the column to appear on the y-axis of the plot. Default is "model".} @@ -40,7 +40,7 @@ Visualise Where Forecasts Are Available } \examples{ library(ggplot2) -available_forecasts <- available_forecasts( +available_forecasts <- get_forecast_counts( example_quantile, by = c("model", "target_type", "target_end_date") ) plot( diff --git a/man/plot_avail_forecasts.Rd b/man/plot_avail_forecasts.Rd deleted file mode 100644 index c10035012..000000000 --- a/man/plot_avail_forecasts.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/plot.R -\name{plot_avail_forecasts} -\alias{plot_avail_forecasts} -\title{Visualise Where Forecasts Are Available \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}} -\usage{ -plot_avail_forecasts( - available_forecasts, - y = "model", - x = "forecast_date", - make_x_factor = TRUE, - show_numbers = TRUE -) -} -\arguments{ -\item{available_forecasts}{an S3 object of class "scoringutils_available_forecasts" -as produced by \code{\link[=available_forecasts]{available_forecasts()}}} - -\item{y}{character vector of length one that denotes the name of the column -to appear on the y-axis of the plot. Default is "model".} - -\item{x}{character vector of length one that denotes the name of the column -to appear on the x-axis of the plot. Default is "forecast_date".} - -\item{make_x_factor}{logical (default is TRUE). Whether or not to convert -the variable on the x-axis to a factor. This has an effect e.g. if dates -are shown on the x-axis.} - -\item{show_numbers}{logical (default is \code{TRUE}) that indicates whether -or not to show the actual count numbers on the plot} -} -\description{ -Old version of \code{\link[=plot.scoringutils_available_forecasts]{plot.scoringutils_available_forecasts()}} for compatibility. -} diff --git a/tests/testthat/test-available_forecasts.R b/tests/testthat/test-available_forecasts.R index f8e0ad0c7..ffa9e4f9e 100644 --- a/tests/testthat/test-available_forecasts.R +++ b/tests/testthat/test-available_forecasts.R @@ -1,6 +1,6 @@ -test_that("available_forecasts() works as expected", { +test_that("get_forecast_counts() works as expected", { af <- suppressMessages( - available_forecasts(example_quantile, + get_forecast_counts(example_quantile, by = c("model", "target_type", "target_end_date") ) ) @@ -8,12 +8,12 @@ test_that("available_forecasts() works as expected", { expect_type(af$target_type, "character") expect_type(af$`count`, "integer") expect_equal(nrow(af[is.na(`count`)]), 0) - af <- available_forecasts(example_quantile, by = "model") + af <- get_forecast_counts(example_quantile, by = "model") expect_equal(nrow(af), 4) expect_equal(af$`count`, c(256, 256, 128, 247)) # Setting `collapse = c()` means that all quantiles and samples are counted - af <- available_forecasts( + af <- get_forecast_counts( example_quantile, by = "model", collapse = c() ) @@ -21,13 +21,13 @@ test_that("available_forecasts() works as expected", { expect_equal(af$`count`, c(5888, 5888, 2944, 5681)) # setting by = NULL, the default, results in by equal to forecast unit - af <- available_forecasts(example_quantile) + af <- get_forecast_counts(example_quantile) expect_equal(nrow(af), 50688) # check whether collapsing also works for model-based forecasts - af <- available_forecasts(example_integer, by = "model") + af <- get_forecast_counts(example_integer, by = "model") expect_equal(nrow(af), 4) - af <- available_forecasts(example_integer, by = "model", collapse = c()) + af <- get_forecast_counts(example_integer, by = "model", collapse = c()) expect_equal(af$count, c(10240, 10240, 5120, 9880)) }) diff --git a/tests/testthat/test-plot_avail_forecasts.R b/tests/testthat/test-plot_avail_forecasts.R index 9f2efea6b..a246987c1 100644 --- a/tests/testthat/test-plot_avail_forecasts.R +++ b/tests/testthat/test-plot_avail_forecasts.R @@ -1,8 +1,7 @@ -test_that("plot_available_forecasts() works as expected", { - available_forecasts <- suppressMessages( - available_forecasts(example_quantile, - by = c("model", "target_type", "target_end_date") - ) +test_that("plot.forecast_counts() works as expected", { + available_forecasts <- get_forecast_counts( + example_quantile, + by = c("model", "target_type", "target_end_date") ) p <- plot(available_forecasts, xvar = "target_end_date", show_numbers = FALSE diff --git a/vignettes/scoringutils.Rmd b/vignettes/scoringutils.Rmd index 4ae09b2ac..e4b4e4c61 100644 --- a/vignettes/scoringutils.Rmd +++ b/vignettes/scoringutils.Rmd @@ -79,10 +79,10 @@ The output of `validate()` can later be directly used as input to `score()` (oth ## Showing available forecasts -The function `available_forecasts()` may also be helpful to determine where forecasts are available. Using the `by` argument you can specify the level of summary. For example, to see how many forecasts there are per model and target_type, we can run +The function `get_forecast_counts()` may also be helpful to determine where forecasts are available. Using the `by` argument you can specify the level of summary. For example, to see how many forecasts there are per model and target_type, we can run ```{r} -available_forecasts(example_quantile, by = c("model", "target_type")) +get_forecast_counts(example_quantile, by = c("model", "target_type")) ``` We see that 'epiforecasts-EpiNow2' has some missing forecasts for the deaths forecast target and that UMass-MechBayes has no case forecasts. @@ -91,7 +91,7 @@ This information can also be visualised using `plot()`: ```{r, fig.width=11, fig.height=6} example_quantile %>% - available_forecasts(by = c("model", "forecast_date", "target_type")) %>% + get_forecast_counts(by = c("model", "forecast_date", "target_type")) %>% plot() + facet_wrap(~ target_type) ``` @@ -107,7 +107,7 @@ example_quantile %>% ) %>% make_NA( what = "forecast", - model != "EuroCOVIDhub-ensemble", + model != "EuroCOVIDhub-ense mble", forecast_date != "2021-06-28" ) %>% plot_predictions( From 1626fce249c871ba9ffbb8769961a91718aa76fd Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Tue, 28 Nov 2023 14:11:43 +0100 Subject: [PATCH 04/12] Update NEWS file --- NEWS.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 0faf9eaf2..3ba310daf 100644 --- a/NEWS.md +++ b/NEWS.md @@ -25,10 +25,10 @@ The update introduces breaking changes. If you want to keep using the older vers - `add_coverage()` was reworked completely. It's new purpose is now to add coverage information to the raw forecast data (essentially fulfilling some of the functionality that was previously covered by `score_quantile()`) - The function `find_duplicates()` was renamed to `get_duplicate_forecasts()` - Changes to `avail_forecasts()` and `plot_avail_forecasts()`: - - The function `avail_forecasts()` was renamed to `available_forecasts()` for consistency with `available_metrics()`. The old function, `avail_forecasts()` is still available as an alias, but will be removed in the future. - - For clarity, the output column in `avail_forecasts()` was renamed from "Number forecasts" to "count". - - `available_forecasts()` now also displays combinations where there are 0 forecasts, instead of silently dropping corresponding rows. - - `plot_avail_forecasts()` has been deprecated in favour of an S3 method for `plot()`. An alias is still available, but will be removed in the future. + - The function `avail_forecasts()` was renamed to `get_forecast_counts()`. This represents a change in the naming convention where we aim to name functions that provide the user with addtional useful information about the data with a prefix "get_". + - For clarity, the output column in `get_forecast_counts()` was renamed from "Number forecasts" to "count". + - `get_forecast_counts()` now also displays combinations where there are 0 forecasts, instead of silently dropping corresponding rows. + - `plot_avail_forecasts()` has been deprecated in favour of an S3 method for `plot()`. - The deprecated `..density..` was replaced with `after_stat(density)` in ggplot calls. - Files ending in ".Rda" were renamed to ".rds" where appropriate when used together with `saveRDS()` or `readRDS()`. - added documentation for the return value of `summarise_scores()`. From 4ff6d58cca60b48b7ea9bd6437ec77b8cff53a5c Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Tue, 28 Nov 2023 14:12:43 +0100 Subject: [PATCH 05/12] Small correction in a previous news item --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 3ba310daf..7c9f284ef 100644 --- a/NEWS.md +++ b/NEWS.md @@ -188,7 +188,7 @@ to a function `summarise_scores()` - New function `check_forecasts()` to analyse input data before scoring - New function `correlation()` to compute correlations between different metrics - New function `add_coverage()` to add coverage for specific central prediction intervals. -- New function `available_forecasts()` allows to visualise the number of available forecasts. +- New function `avail_forecasts()` allows to visualise the number of available forecasts. - New function `find_duplicates()` to find duplicate forecasts which cause an error. - All plotting functions were renamed to begin with `plot_`. Arguments were simplified. From 0b8a23d70af0c071720ae5484d5cc76ff302fd4a Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Tue, 28 Nov 2023 14:20:22 +0100 Subject: [PATCH 06/12] Update News item --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 7c9f284ef..57b0c07e2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -25,7 +25,7 @@ The update introduces breaking changes. If you want to keep using the older vers - `add_coverage()` was reworked completely. It's new purpose is now to add coverage information to the raw forecast data (essentially fulfilling some of the functionality that was previously covered by `score_quantile()`) - The function `find_duplicates()` was renamed to `get_duplicate_forecasts()` - Changes to `avail_forecasts()` and `plot_avail_forecasts()`: - - The function `avail_forecasts()` was renamed to `get_forecast_counts()`. This represents a change in the naming convention where we aim to name functions that provide the user with addtional useful information about the data with a prefix "get_". + - The function `avail_forecasts()` was renamed to `get_forecast_counts()`. This represents a change in the naming convention where we aim to name functions that provide the user with addtional useful information about the data with a prefix "get_". See Issue #403 and PR #511 by @nikosbosse and reviewed by @seabbs for details. - For clarity, the output column in `get_forecast_counts()` was renamed from "Number forecasts" to "count". - `get_forecast_counts()` now also displays combinations where there are 0 forecasts, instead of silently dropping corresponding rows. - `plot_avail_forecasts()` has been deprecated in favour of an S3 method for `plot()`. From 0cfb741777b21203b02a9207211d345215b81b92 Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Tue, 28 Nov 2023 14:43:20 +0100 Subject: [PATCH 07/12] fix linting issues --- R/available_forecasts.R | 2 +- R/plot.R | 2 +- vignettes/scoringutils.Rmd | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/available_forecasts.R b/R/available_forecasts.R index 9f933f701..b6eed078d 100644 --- a/R/available_forecasts.R +++ b/R/available_forecasts.R @@ -58,7 +58,7 @@ get_forecast_counts <- function(data, data <- data[data[, .I[1], by = collapse_by]$V1] # count number of rows = number of forecasts - out <- data[, .(`count` = .N), by = by] + out <- data[, .(count = .N), by = by] # make sure that all combinations in "by" are included in the output (with # count = 0). To achieve that, take the unique values in data and expand grid diff --git a/R/plot.R b/R/plot.R index 14c5e12b2..8fd17e285 100644 --- a/R/plot.R +++ b/R/plot.R @@ -470,7 +470,7 @@ plot_predictions <- function(data, # it separately here to deal with the case when only the median is provided # (in which case ggdist::geom_lineribbon() will fail) if (0 %in% range) { - select_median <- (forecasts$range %in% 0 & forecasts$boundary == "lower") + select_median <- (forecasts$range == 0 & forecasts$boundary == "lower") median <- forecasts[select_median] if (nrow(median) > 0) { diff --git a/vignettes/scoringutils.Rmd b/vignettes/scoringutils.Rmd index e4b4e4c61..da2898fb6 100644 --- a/vignettes/scoringutils.Rmd +++ b/vignettes/scoringutils.Rmd @@ -35,7 +35,7 @@ Most of the time, the `score()` function will be able to do the entire evaluatio ```{r, echo=FALSE} requirements <- data.table( - "Format" = c( + Format = c( "quantile-based", "sample-based", "binary", "pairwise-comparisons" ), `Required columns` = c( From c48d6dd5a7ecdebcf62878d3374036aa6b3517cb Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Wed, 29 Nov 2023 11:58:15 +0100 Subject: [PATCH 08/12] Rename class "forecast_count" to "prediction_count" --- NAMESPACE | 2 +- R/available_forecasts.R | 2 +- R/plot.R | 14 +++++++------- ...orecast_counts.Rd => plot.prediction_counts.Rd} | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) rename man/{plot.forecast_counts.Rd => plot.prediction_counts.Rd} (90%) diff --git a/NAMESPACE b/NAMESPACE index 0bd3337ec..ad4f49cba 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,6 @@ # Generated by roxygen2: do not edit by hand -S3method(plot,forecast_counts) +S3method(plot,prediction_counts) S3method(print,scoringutils_check) S3method(quantile_to_interval,data.frame) S3method(quantile_to_interval,numeric) diff --git a/R/available_forecasts.R b/R/available_forecasts.R index b6eed078d..946cbc519 100644 --- a/R/available_forecasts.R +++ b/R/available_forecasts.R @@ -70,7 +70,7 @@ get_forecast_counts <- function(data, out <- merge(out, out_empty, by = by, all.y = TRUE) out[, count := nafill(count, fill = 0)] - class(out) <- c("forecast_counts", class(out)) + class(out) <- c("prediction_counts", class(out)) return(out[]) } diff --git a/R/plot.R b/R/plot.R index 8fd17e285..a8244207c 100644 --- a/R/plot.R +++ b/R/plot.R @@ -942,7 +942,7 @@ plot_pit <- function(pit, #' @description #' Visualise Where Forecasts Are Available #' @inheritParams print.scoringutils_check -#' @param x an S3 object of class "forecast_counts" +#' @param x an S3 object of class "prediction_counts" #' as produced by [get_forecast_counts()] #' @param yvar character vector of length one that denotes the name of the column #' to appear on the y-axis of the plot. Default is "model". @@ -968,12 +968,12 @@ plot_pit <- function(pit, #' ) + #' facet_wrap("target_type") -plot.forecast_counts <- function(x, - yvar = "model", - xvar = "forecast_date", - make_xvar_factor = TRUE, - show_numbers = TRUE, - ...) { +plot.prediction_counts <- function(x, + yvar = "model", + xvar = "forecast_date", + make_xvar_factor = TRUE, + show_numbers = TRUE, + ...) { x <- as.data.table(x) if (make_xvar_factor) { diff --git a/man/plot.forecast_counts.Rd b/man/plot.prediction_counts.Rd similarity index 90% rename from man/plot.forecast_counts.Rd rename to man/plot.prediction_counts.Rd index 8ace053b4..d3343d659 100644 --- a/man/plot.forecast_counts.Rd +++ b/man/plot.prediction_counts.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/plot.R -\name{plot.forecast_counts} -\alias{plot.forecast_counts} +\name{plot.prediction_counts} +\alias{plot.prediction_counts} \title{Visualise Where Forecasts Are Available} \usage{ -\method{plot}{forecast_counts}( +\method{plot}{prediction_counts}( x, yvar = "model", xvar = "forecast_date", @@ -14,7 +14,7 @@ ) } \arguments{ -\item{x}{an S3 object of class "forecast_counts" +\item{x}{an S3 object of class "prediction_counts" as produced by \code{\link[=get_forecast_counts]{get_forecast_counts()}}} \item{yvar}{character vector of length one that denotes the name of the column From 18f42a80d335d6048a2132714c1ada5a9d2d5e51 Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Tue, 5 Dec 2023 13:03:29 +0100 Subject: [PATCH 09/12] Create `plot_forecast_counts()` to replace previous S3 method --- NAMESPACE | 2 +- R/available_forecasts.R | 2 - R/plot.R | 45 +++++++++---------- ...tion_counts.Rd => plot_forecast_counts.Rd} | 33 +++++++------- tests/testthat/test-plot_avail_forecasts.R | 4 +- vignettes/scoringutils.Rmd | 2 +- 6 files changed, 40 insertions(+), 48 deletions(-) rename man/{plot.prediction_counts.Rd => plot_forecast_counts.Rd} (51%) diff --git a/NAMESPACE b/NAMESPACE index ad4f49cba..d44c528b8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,5 @@ # Generated by roxygen2: do not edit by hand -S3method(plot,prediction_counts) S3method(print,scoringutils_check) S3method(quantile_to_interval,data.frame) S3method(quantile_to_interval,numeric) @@ -49,6 +48,7 @@ export(pairwise_comparison) export(pit) export(pit_sample) export(plot_correlation) +export(plot_forecast_counts) export(plot_heatmap) export(plot_interval_coverage) export(plot_pairwise_comparison) diff --git a/R/available_forecasts.R b/R/available_forecasts.R index 946cbc519..8225620d3 100644 --- a/R/available_forecasts.R +++ b/R/available_forecasts.R @@ -70,7 +70,5 @@ get_forecast_counts <- function(data, out <- merge(out, out_empty, by = by, all.y = TRUE) out[, count := nafill(count, fill = 0)] - class(out) <- c("prediction_counts", class(out)) - return(out[]) } diff --git a/R/plot.R b/R/plot.R index a8244207c..4d8d602e3 100644 --- a/R/plot.R +++ b/R/plot.R @@ -942,13 +942,13 @@ plot_pit <- function(pit, #' @description #' Visualise Where Forecasts Are Available #' @inheritParams print.scoringutils_check -#' @param x an S3 object of class "prediction_counts" +#' @param forecast_counts a data.table (or similar) with forecast counts #' as produced by [get_forecast_counts()] -#' @param yvar character vector of length one that denotes the name of the column +#' @param y character vector of length one that denotes the name of the column #' to appear on the y-axis of the plot. Default is "model". -#' @param xvar character vector of length one that denotes the name of the column -#' to appear on the x-axis of the plot. Default is "forecast_date". -#' @param make_xvar_factor logical (default is TRUE). Whether or not to convert +#' @param x character vector of length one that denotes the name of the column +#' to appear on the x-axis of the plot. +#' @param make_x_factor logical (default is TRUE). Whether or not to convert #' the variable on the x-axis to a factor. This has an effect e.g. if dates #' are shown on the x-axis. #' @param show_numbers logical (default is `TRUE`) that indicates whether @@ -960,35 +960,34 @@ plot_pit <- function(pit, #' @export #' @examples #' library(ggplot2) -#' available_forecasts <- get_forecast_counts( +#' forecast_counts <- get_forecast_counts( #' example_quantile, by = c("model", "target_type", "target_end_date") #' ) -#' plot( -#' available_forecasts, xvar = "target_end_date", show_numbers = FALSE +#' plot_forecast_counts( +#' forecast_counts, x = "target_end_date", show_numbers = FALSE #' ) + #' facet_wrap("target_type") -plot.prediction_counts <- function(x, - yvar = "model", - xvar = "forecast_date", - make_xvar_factor = TRUE, - show_numbers = TRUE, - ...) { - x <- as.data.table(x) +plot_forecast_counts <- function(forecast_counts, + y = "model", + x, + make_x_factor = TRUE, + show_numbers = TRUE) { - if (make_xvar_factor) { - x[, eval(xvar) := as.factor(get(xvar))] + forecast_counts <- ensure_data.table(forecast_counts) + + if (make_x_factor) { + forecast_counts[, eval(x) := as.factor(get(x))] } - setnames(x, old = "count", new = "Count") + setnames(forecast_counts, old = "count", new = "Count") plot <- ggplot( - x, - aes(y = .data[[yvar]], x = .data[[xvar]]) + forecast_counts, + aes(y = .data[[y]], x = .data[[x]]) ) + geom_tile(aes(fill = `Count`), - width = 0.97, height = 0.97 - ) + + width = 0.97, height = 0.97) + scale_fill_gradient( low = "grey95", high = "steelblue", na.value = "lightgrey" @@ -1001,12 +1000,10 @@ plot.prediction_counts <- function(x, ) ) + theme(panel.spacing = unit(2, "lines")) - if (show_numbers) { plot <- plot + geom_text(aes(label = `Count`)) } - return(plot) } diff --git a/man/plot.prediction_counts.Rd b/man/plot_forecast_counts.Rd similarity index 51% rename from man/plot.prediction_counts.Rd rename to man/plot_forecast_counts.Rd index d3343d659..c4f4cade9 100644 --- a/man/plot.prediction_counts.Rd +++ b/man/plot_forecast_counts.Rd @@ -1,36 +1,33 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/plot.R -\name{plot.prediction_counts} -\alias{plot.prediction_counts} +\name{plot_forecast_counts} +\alias{plot_forecast_counts} \title{Visualise Where Forecasts Are Available} \usage{ -\method{plot}{prediction_counts}( +plot_forecast_counts( + forecast_counts, + y = "model", x, - yvar = "model", - xvar = "forecast_date", - make_xvar_factor = TRUE, - show_numbers = TRUE, - ... + make_x_factor = TRUE, + show_numbers = TRUE ) } \arguments{ -\item{x}{an S3 object of class "prediction_counts" +\item{forecast_counts}{a data.table (or similar) with forecast counts as produced by \code{\link[=get_forecast_counts]{get_forecast_counts()}}} -\item{yvar}{character vector of length one that denotes the name of the column +\item{y}{character vector of length one that denotes the name of the column to appear on the y-axis of the plot. Default is "model".} -\item{xvar}{character vector of length one that denotes the name of the column -to appear on the x-axis of the plot. Default is "forecast_date".} +\item{x}{character vector of length one that denotes the name of the column +to appear on the x-axis of the plot.} -\item{make_xvar_factor}{logical (default is TRUE). Whether or not to convert +\item{make_x_factor}{logical (default is TRUE). Whether or not to convert the variable on the x-axis to a factor. This has an effect e.g. if dates are shown on the x-axis.} \item{show_numbers}{logical (default is \code{TRUE}) that indicates whether or not to show the actual count numbers on the plot} - -\item{...}{additional arguments (not used here)} } \value{ ggplot object with a plot of interval coverage @@ -40,11 +37,11 @@ Visualise Where Forecasts Are Available } \examples{ library(ggplot2) -available_forecasts <- get_forecast_counts( +forecast_counts <- get_forecast_counts( example_quantile, by = c("model", "target_type", "target_end_date") ) -plot( - available_forecasts, xvar = "target_end_date", show_numbers = FALSE +plot_forecast_counts( + forecast_counts, x = "target_end_date", show_numbers = FALSE ) + facet_wrap("target_type") } diff --git a/tests/testthat/test-plot_avail_forecasts.R b/tests/testthat/test-plot_avail_forecasts.R index a246987c1..d34caec51 100644 --- a/tests/testthat/test-plot_avail_forecasts.R +++ b/tests/testthat/test-plot_avail_forecasts.R @@ -3,8 +3,8 @@ test_that("plot.forecast_counts() works as expected", { example_quantile, by = c("model", "target_type", "target_end_date") ) - p <- plot(available_forecasts, - xvar = "target_end_date", show_numbers = FALSE + p <- plot_forecast_counts(available_forecasts, + x = "target_end_date", show_numbers = FALSE ) + facet_wrap("target_type") expect_s3_class(p, "ggplot") diff --git a/vignettes/scoringutils.Rmd b/vignettes/scoringutils.Rmd index da2898fb6..92e532335 100644 --- a/vignettes/scoringutils.Rmd +++ b/vignettes/scoringutils.Rmd @@ -92,7 +92,7 @@ This information can also be visualised using `plot()`: ```{r, fig.width=11, fig.height=6} example_quantile %>% get_forecast_counts(by = c("model", "forecast_date", "target_type")) %>% - plot() + + plot_forecast_counts(x = "forecast_date") + facet_wrap(~ target_type) ``` From 8c65056e4085f515a9f87d1eb275681ac7ebcb69 Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Tue, 5 Dec 2023 13:21:57 +0100 Subject: [PATCH 10/12] Update NEWS file --- NEWS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 57b0c07e2..4067c6d9f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -25,10 +25,10 @@ The update introduces breaking changes. If you want to keep using the older vers - `add_coverage()` was reworked completely. It's new purpose is now to add coverage information to the raw forecast data (essentially fulfilling some of the functionality that was previously covered by `score_quantile()`) - The function `find_duplicates()` was renamed to `get_duplicate_forecasts()` - Changes to `avail_forecasts()` and `plot_avail_forecasts()`: - - The function `avail_forecasts()` was renamed to `get_forecast_counts()`. This represents a change in the naming convention where we aim to name functions that provide the user with addtional useful information about the data with a prefix "get_". See Issue #403 and PR #511 by @nikosbosse and reviewed by @seabbs for details. + - The function `avail_forecasts()` was renamed to `get_forecast_counts()`. This represents a change in the naming convention where we aim to name functions that provide the user with additional useful information about the data with a prefix "get_". Sees Issue #403 and #521 and PR #511 by @nikosbosse and reviewed by @seabbs for details. - For clarity, the output column in `get_forecast_counts()` was renamed from "Number forecasts" to "count". - `get_forecast_counts()` now also displays combinations where there are 0 forecasts, instead of silently dropping corresponding rows. - - `plot_avail_forecasts()` has been deprecated in favour of an S3 method for `plot()`. + - `plot_avail_forecasts()` was renamed `plot_forecast_counts()` in line with the change in the function name. The `x` argument no longer has a default value, as the value will depend on the data provided by the user. - The deprecated `..density..` was replaced with `after_stat(density)` in ggplot calls. - Files ending in ".Rda" were renamed to ".rds" where appropriate when used together with `saveRDS()` or `readRDS()`. - added documentation for the return value of `summarise_scores()`. From 14632210043daef1bd762ad6ba172e09aebba8e4 Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Wed, 6 Dec 2023 14:33:41 +0100 Subject: [PATCH 11/12] Add input checks to `plot_forecast_counts()` --- NAMESPACE | 1 + R/plot.R | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index d44c528b8..d05f4258d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -86,6 +86,7 @@ importFrom(checkmate,assert_list) importFrom(checkmate,assert_logical) importFrom(checkmate,assert_number) importFrom(checkmate,assert_numeric) +importFrom(checkmate,assert_string) importFrom(checkmate,assert_vector) importFrom(checkmate,check_atomic_vector) importFrom(checkmate,check_data_frame) diff --git a/R/plot.R b/R/plot.R index 4d8d602e3..23894bafb 100644 --- a/R/plot.R +++ b/R/plot.R @@ -957,6 +957,7 @@ plot_pit <- function(pit, #' @importFrom ggplot2 ggplot scale_colour_manual scale_fill_manual #' geom_tile scale_fill_gradient .data #' @importFrom data.table dcast .I .N +#' @importFrom checkmate assert_string assert_logical #' @export #' @examples #' library(ggplot2) @@ -975,6 +976,10 @@ plot_forecast_counts <- function(forecast_counts, show_numbers = TRUE) { forecast_counts <- ensure_data.table(forecast_counts) + assert_string(y) + assert_string(x) + assert_logical(make_x_factor) + assert_logical(show_numbers) if (make_x_factor) { forecast_counts[, eval(x) := as.factor(get(x))] From edeeae782e797fd133551e72e2adb06400e8af64 Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Wed, 6 Dec 2023 16:35:49 +0100 Subject: [PATCH 12/12] Update arguments for `plot_forecast_counts()` --- R/plot.R | 32 +++++++++---------- .../R/00-standalone-Figure-replication.R | 2 +- inst/manuscript/manuscript.Rmd | 2 +- man/plot_forecast_counts.Rd | 22 ++++++------- tests/testthat/test-plot_avail_forecasts.R | 2 +- vignettes/scoringutils.Rmd | 2 +- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/R/plot.R b/R/plot.R index 23894bafb..1527ef8e6 100644 --- a/R/plot.R +++ b/R/plot.R @@ -941,23 +941,22 @@ plot_pit <- function(pit, #' #' @description #' Visualise Where Forecasts Are Available -#' @inheritParams print.scoringutils_check -#' @param forecast_counts a data.table (or similar) with forecast counts -#' as produced by [get_forecast_counts()] -#' @param y character vector of length one that denotes the name of the column -#' to appear on the y-axis of the plot. Default is "model". +#' @param forecast_counts a data.table (or similar) with a column `count` +#' holding forecast counts, as produced by [get_forecast_counts()] #' @param x character vector of length one that denotes the name of the column #' to appear on the x-axis of the plot. -#' @param make_x_factor logical (default is TRUE). Whether or not to convert +#' @param y character vector of length one that denotes the name of the column +#' to appear on the y-axis of the plot. Default is "model". +#' @param x_as_factor logical (default is TRUE). Whether or not to convert #' the variable on the x-axis to a factor. This has an effect e.g. if dates #' are shown on the x-axis. -#' @param show_numbers logical (default is `TRUE`) that indicates whether +#' @param show_counts logical (default is `TRUE`) that indicates whether #' or not to show the actual count numbers on the plot #' @return ggplot object with a plot of interval coverage #' @importFrom ggplot2 ggplot scale_colour_manual scale_fill_manual #' geom_tile scale_fill_gradient .data #' @importFrom data.table dcast .I .N -#' @importFrom checkmate assert_string assert_logical +#' @importFrom checkmate assert_string assert_logical assert #' @export #' @examples #' library(ggplot2) @@ -965,23 +964,24 @@ plot_pit <- function(pit, #' example_quantile, by = c("model", "target_type", "target_end_date") #' ) #' plot_forecast_counts( -#' forecast_counts, x = "target_end_date", show_numbers = FALSE +#' forecast_counts, x = "target_end_date", show_counts = FALSE #' ) + #' facet_wrap("target_type") plot_forecast_counts <- function(forecast_counts, - y = "model", x, - make_x_factor = TRUE, - show_numbers = TRUE) { + y = "model", + x_as_factor = TRUE, + show_counts = TRUE) { forecast_counts <- ensure_data.table(forecast_counts) assert_string(y) assert_string(x) - assert_logical(make_x_factor) - assert_logical(show_numbers) + assert(check_columns_present(forecast_counts, c(y, x))) + assert_logical(x_as_factor) + assert_logical(show_counts) - if (make_x_factor) { + if (x_as_factor) { forecast_counts[, eval(x) := as.factor(get(x))] } @@ -1005,7 +1005,7 @@ plot_forecast_counts <- function(forecast_counts, ) ) + theme(panel.spacing = unit(2, "lines")) - if (show_numbers) { + if (show_counts) { plot <- plot + geom_text(aes(label = `Count`)) } diff --git a/inst/manuscript/R/00-standalone-Figure-replication.R b/inst/manuscript/R/00-standalone-Figure-replication.R index 3b1b66b9c..373f25ec4 100644 --- a/inst/manuscript/R/00-standalone-Figure-replication.R +++ b/inst/manuscript/R/00-standalone-Figure-replication.R @@ -537,7 +537,7 @@ p2 + p1 + p_true + available_forecasts(data = example_integer, by = c("model", "target_type", "forecast_date")) |> plot_available_forecasts(x = "forecast_date", - show_numbers = FALSE) + + show_counts = FALSE) + facet_wrap(~ target_type) + labs(y = "Model", x = "Forecast date") diff --git a/inst/manuscript/manuscript.Rmd b/inst/manuscript/manuscript.Rmd index e907defac..782dc468d 100644 --- a/inst/manuscript/manuscript.Rmd +++ b/inst/manuscript/manuscript.Rmd @@ -432,7 +432,7 @@ library("ggplot2") available_forecasts(data = example_integer, by = c("model", "target_type", "forecast_date")) |> plot_available_forecasts(x = "forecast_date", - show_numbers = FALSE) + + show_counts = FALSE) + facet_wrap(~ target_type) + labs(y = "Model", x = "Forecast date") ``` diff --git a/man/plot_forecast_counts.Rd b/man/plot_forecast_counts.Rd index c4f4cade9..c5285c9dd 100644 --- a/man/plot_forecast_counts.Rd +++ b/man/plot_forecast_counts.Rd @@ -6,27 +6,27 @@ \usage{ plot_forecast_counts( forecast_counts, - y = "model", x, - make_x_factor = TRUE, - show_numbers = TRUE + y = "model", + x_as_factor = TRUE, + show_counts = TRUE ) } \arguments{ -\item{forecast_counts}{a data.table (or similar) with forecast counts -as produced by \code{\link[=get_forecast_counts]{get_forecast_counts()}}} - -\item{y}{character vector of length one that denotes the name of the column -to appear on the y-axis of the plot. Default is "model".} +\item{forecast_counts}{a data.table (or similar) with a column \code{count} +holding forecast counts, as produced by \code{\link[=get_forecast_counts]{get_forecast_counts()}}} \item{x}{character vector of length one that denotes the name of the column to appear on the x-axis of the plot.} -\item{make_x_factor}{logical (default is TRUE). Whether or not to convert +\item{y}{character vector of length one that denotes the name of the column +to appear on the y-axis of the plot. Default is "model".} + +\item{x_as_factor}{logical (default is TRUE). Whether or not to convert the variable on the x-axis to a factor. This has an effect e.g. if dates are shown on the x-axis.} -\item{show_numbers}{logical (default is \code{TRUE}) that indicates whether +\item{show_counts}{logical (default is \code{TRUE}) that indicates whether or not to show the actual count numbers on the plot} } \value{ @@ -41,7 +41,7 @@ forecast_counts <- get_forecast_counts( example_quantile, by = c("model", "target_type", "target_end_date") ) plot_forecast_counts( - forecast_counts, x = "target_end_date", show_numbers = FALSE + forecast_counts, x = "target_end_date", show_counts = FALSE ) + facet_wrap("target_type") } diff --git a/tests/testthat/test-plot_avail_forecasts.R b/tests/testthat/test-plot_avail_forecasts.R index d34caec51..f131a6d7a 100644 --- a/tests/testthat/test-plot_avail_forecasts.R +++ b/tests/testthat/test-plot_avail_forecasts.R @@ -4,7 +4,7 @@ test_that("plot.forecast_counts() works as expected", { by = c("model", "target_type", "target_end_date") ) p <- plot_forecast_counts(available_forecasts, - x = "target_end_date", show_numbers = FALSE + x = "target_end_date", show_counts = FALSE ) + facet_wrap("target_type") expect_s3_class(p, "ggplot") diff --git a/vignettes/scoringutils.Rmd b/vignettes/scoringutils.Rmd index 92e532335..05ea4b365 100644 --- a/vignettes/scoringutils.Rmd +++ b/vignettes/scoringutils.Rmd @@ -107,7 +107,7 @@ example_quantile %>% ) %>% make_NA( what = "forecast", - model != "EuroCOVIDhub-ense mble", + model != "EuroCOVIDhub-ensemble", forecast_date != "2021-06-28" ) %>% plot_predictions(