From 63b45a9334ce9495667a06cba1f7b6c0c4f0ea6b Mon Sep 17 00:00:00 2001 From: Hugo Gruson Date: Mon, 20 Jun 2022 12:58:10 +0200 Subject: [PATCH] Specify which column name clashes with metrics --- R/check_forecasts.R | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/R/check_forecasts.R b/R/check_forecasts.R index be06a87cc..6c8778608 100644 --- a/R/check_forecasts.R +++ b/R/check_forecasts.R @@ -70,10 +70,17 @@ check_forecasts <- function(data) { } # check whether any column name is a scoringutils metric - if (any(colnames(data) %in% available_metrics())) { + clashing_colnames <- intersect(colnames(data), available_metrics()) + if (length(clashing_colnames) > 0) { + clashing_colnames <- paste0('"', clashing_colnames, '"') warnings <- c( warnings, - "At least one column in the data corresponds to the name of a metric that will be computed by scoringutils. Please check `available_metrics()`" # nolint + paste0( + "At least one column in the data ", + "(", paste(clashing_colnames, collapse = ", "), ") ", + "corresponds to the name of a metric that will be computed by ", + "scoringutils. Please check `available_metrics()`" + ) ) }