From 6aceaaad4b688b571df571836b13e4591fa57ddd Mon Sep 17 00:00:00 2001 From: Nikos Bosse <37978797+nikosbosse@users.noreply.github.com> Date: Mon, 20 May 2024 21:58:49 +0100 Subject: [PATCH] Clean a few minor things (#814) * improve message * fix typo in docs * add missing rdname tags to assert_forecast --- R/documentation-templates.R | 2 +- R/forecast.R | 3 +++ R/metrics-quantile.R | 2 +- man/as_forecast.Rd | 2 +- man/assert_forecast.Rd | 9 +++++++++ man/forecast_types.Rd | 2 +- man/get_forecast_unit.Rd | 2 +- man/score.Rd | 2 +- tests/testthat/test-metrics-quantile.R | 2 +- 9 files changed, 19 insertions(+), 7 deletions(-) diff --git a/R/documentation-templates.R b/R/documentation-templates.R index cd2889c2..9878d8cb 100644 --- a/R/documentation-templates.R +++ b/R/documentation-templates.R @@ -51,7 +51,7 @@ #' of the data belong together and jointly form a single forecasts. This is #' easy e.g. for point forecast, where there is one row per forecast. For #' quantile or sample-based forecasts, however, there are multiple rows that -#' belong to single forecast. +#' belong to a single forecast. #' #' The *forecast unit* or *unit of a single forecast* is then described by the #' combination of columns that uniquely identify a single forecast. diff --git a/R/forecast.R b/R/forecast.R index f0bc738c..01256ca9 100644 --- a/R/forecast.R +++ b/R/forecast.R @@ -196,6 +196,7 @@ assert_forecast <- function( #' @importFrom cli cli_abort +#' @rdname assert_forecast #' @export #' @keywords check-forecasts assert_forecast.default <- function( @@ -211,6 +212,7 @@ assert_forecast.default <- function( #' @export +#' @rdname assert_forecast #' @importFrom cli cli_abort #' @keywords check-forecasts assert_forecast.forecast_binary <- function( @@ -247,6 +249,7 @@ assert_forecast.forecast_binary <- function( #' @export +#' @rdname assert_forecast #' @importFrom cli cli_abort #' @keywords check-forecasts assert_forecast.forecast_point <- function( diff --git a/R/metrics-quantile.R b/R/metrics-quantile.R index d537f1d3..1a1121e1 100644 --- a/R/metrics-quantile.R +++ b/R/metrics-quantile.R @@ -445,7 +445,7 @@ bias_quantile <- function(observed, predicted, quantile_level, na.rm = TRUE) { #nolint start: keyword_quote_linter cli_inform( c( - "i" = "Median not available, computing bias as mean of the two + "i" = "Median not available, interpolating median from the two innermost quantiles in order to compute bias." ) ) diff --git a/man/as_forecast.Rd b/man/as_forecast.Rd index dccb753e..91a4e5e8 100644 --- a/man/as_forecast.Rd +++ b/man/as_forecast.Rd @@ -132,7 +132,7 @@ In order to score forecasts, \code{scoringutils} needs to know which of the rows of the data belong together and jointly form a single forecasts. This is easy e.g. for point forecast, where there is one row per forecast. For quantile or sample-based forecasts, however, there are multiple rows that -belong to single forecast. +belong to a single forecast. The \emph{forecast unit} or \emph{unit of a single forecast} is then described by the combination of columns that uniquely identify a single forecast. diff --git a/man/assert_forecast.Rd b/man/assert_forecast.Rd index 84a552a5..e2858d9e 100644 --- a/man/assert_forecast.Rd +++ b/man/assert_forecast.Rd @@ -2,12 +2,21 @@ % Please edit documentation in R/forecast.R \name{assert_forecast} \alias{assert_forecast} +\alias{assert_forecast.default} +\alias{assert_forecast.forecast_binary} +\alias{assert_forecast.forecast_point} \alias{assert_forecast.forecast_quantile} \alias{assert_forecast.forecast_sample} \title{Assert that input is a forecast object and passes validations} \usage{ assert_forecast(forecast, forecast_type = NULL, verbose = TRUE, ...) +\method{assert_forecast}{default}(forecast, forecast_type = NULL, verbose = TRUE, ...) + +\method{assert_forecast}{forecast_binary}(forecast, forecast_type = NULL, verbose = TRUE, ...) + +\method{assert_forecast}{forecast_point}(forecast, forecast_type = NULL, verbose = TRUE, ...) + \method{assert_forecast}{forecast_quantile}(forecast, forecast_type = NULL, verbose = TRUE, ...) \method{assert_forecast}{forecast_sample}(forecast, forecast_type = NULL, verbose = TRUE, ...) diff --git a/man/forecast_types.Rd b/man/forecast_types.Rd index 8037f487..4c4d2648 100644 --- a/man/forecast_types.Rd +++ b/man/forecast_types.Rd @@ -58,7 +58,7 @@ In order to score forecasts, \code{scoringutils} needs to know which of the rows of the data belong together and jointly form a single forecasts. This is easy e.g. for point forecast, where there is one row per forecast. For quantile or sample-based forecasts, however, there are multiple rows that -belong to single forecast. +belong to a single forecast. The \emph{forecast unit} or \emph{unit of a single forecast} is then described by the combination of columns that uniquely identify a single forecast. diff --git a/man/get_forecast_unit.Rd b/man/get_forecast_unit.Rd index 60af4f64..ac1756f9 100644 --- a/man/get_forecast_unit.Rd +++ b/man/get_forecast_unit.Rd @@ -28,7 +28,7 @@ In order to score forecasts, \code{scoringutils} needs to know which of the rows of the data belong together and jointly form a single forecasts. This is easy e.g. for point forecast, where there is one row per forecast. For quantile or sample-based forecasts, however, there are multiple rows that -belong to single forecast. +belong to a single forecast. The \emph{forecast unit} or \emph{unit of a single forecast} is then described by the combination of columns that uniquely identify a single forecast. diff --git a/man/score.Rd b/man/score.Rd index 4f06da04..c39b6722 100644 --- a/man/score.Rd +++ b/man/score.Rd @@ -104,7 +104,7 @@ In order to score forecasts, \code{scoringutils} needs to know which of the rows of the data belong together and jointly form a single forecasts. This is easy e.g. for point forecast, where there is one row per forecast. For quantile or sample-based forecasts, however, there are multiple rows that -belong to single forecast. +belong to a single forecast. The \emph{forecast unit} or \emph{unit of a single forecast} is then described by the combination of columns that uniquely identify a single forecast. diff --git a/tests/testthat/test-metrics-quantile.R b/tests/testthat/test-metrics-quantile.R index 3a8eb7ae..a99ae71c 100644 --- a/tests/testthat/test-metrics-quantile.R +++ b/tests/testthat/test-metrics-quantile.R @@ -861,7 +861,7 @@ test_that("bias_quantile(): quantile levels must be unique", { test_that("bias_quantile only produces one message", { expect_message( bias_quantile(observed, predicted[, -3], quantile_level[-3]), - "Median not available, computing bias as mean of the two innermost quantiles in order to compute bias." + "Median not available, interpolating median from the two innermost quantiles in order to compute bias." ) })