From 5c7bdb9a130d73147088abcfecc4328800951ed6 Mon Sep 17 00:00:00 2001 From: nikosbosse Date: Wed, 3 Jan 2024 17:04:12 +0100 Subject: [PATCH] Update NAMESPACE imports and documentation --- NAMESPACE | 1 + R/get_-functions.R | 6 ------ R/score.R | 13 ++++++++----- man/get_forecast_unit.Rd | 9 +-------- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index e50c0ff60..c4ba7a2dc 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -116,6 +116,7 @@ importFrom(data.table,melt) importFrom(data.table,nafill) importFrom(data.table,rbindlist) importFrom(data.table,setDT) +importFrom(data.table,setattr) importFrom(data.table,setcolorder) importFrom(data.table,setnames) importFrom(ggdist,geom_lineribbon) diff --git a/R/get_-functions.R b/R/get_-functions.R index c74bbf32f..08bf20593 100644 --- a/R/get_-functions.R +++ b/R/get_-functions.R @@ -152,12 +152,6 @@ get_metrics <- function(scores) { #' [get_protected_columns()] as well as the names of the metrics that were #' specified during scoring, if any. #' @inheritParams validate_forecast -#' @param check_conflict Whether or not to check whether there is a conflict -#' between a stored attribute and the inferred forecast unit. When you create -#' a forecast object, the forecast unit is stored as an attribute. If you -#' later change the columns of the data, the forecast unit as inferred from the -#' data might change compared to the stored attribute. Should this result in a -#' warning? Defaults to FALSE. #' @return A character vector with the column names that define the unit of #' a single forecast #' @export diff --git a/R/score.R b/R/score.R index 691b0cedd..380123416 100644 --- a/R/score.R +++ b/R/score.R @@ -76,7 +76,7 @@ score.default <- function(data, ...) { } #' @importFrom stats na.omit -#' @importFrom data.table na.omit setattr +#' @importFrom data.table setattr #' @rdname score #' @export score.forecast_binary <- function(data, metrics = rules_binary(), ...) { @@ -97,7 +97,8 @@ score.forecast_binary <- function(data, metrics = rules_binary(), ...) { #' @importFrom Metrics se ae ape -#' @importFrom data.table na.omit setattr +#' @importFrom stats na.omit +#' @importFrom data.table setattr #' @rdname score #' @export score.forecast_point <- function(data, metrics = rules_point(), ...) { @@ -115,7 +116,8 @@ score.forecast_point <- function(data, metrics = rules_point(), ...) { return(data[]) } -#' @importFrom data.table na.omit setattr +#' @importFrom stats na.omit +#' @importFrom data.table setattr #' @rdname score #' @export score.forecast_sample <- function(data, metrics = rules_sample(), ...) { @@ -152,8 +154,9 @@ score.forecast_sample <- function(data, metrics = rules_sample(), ...) { return(data[]) } -#' @importFrom data.table na.omit setattr -#' @importFrom data.table `:=` as.data.table rbindlist %like% + +#' @importFrom stats na.omit +#' @importFrom data.table `:=` as.data.table rbindlist %like% setattr #' @rdname score #' @export score.forecast_quantile <- function(data, metrics = rules_quantile(), ...) { diff --git a/man/get_forecast_unit.Rd b/man/get_forecast_unit.Rd index bbe04d016..ff2785030 100644 --- a/man/get_forecast_unit.Rd +++ b/man/get_forecast_unit.Rd @@ -4,17 +4,10 @@ \alias{get_forecast_unit} \title{Get unit of a single forecast} \usage{ -get_forecast_unit(data, check_conflict = FALSE) +get_forecast_unit(data) } \arguments{ \item{data}{A data.frame or data.table with predicted and observed values.} - -\item{check_conflict}{Whether or not to check whether there is a conflict -between a stored attribute and the inferred forecast unit. When you create -a forecast object, the forecast unit is stored as an attribute. If you -later change the columns of the data, the forecast unit as inferred from the -data might change compared to the stored attribute. Should this result in a -warning? Defaults to FALSE.} } \value{ A character vector with the column names that define the unit of