diff --git a/R/check-input-helpers.R b/R/check-input-helpers.R index 31a4760d6..0b1c820e2 100644 --- a/R/check-input-helpers.R +++ b/R/check-input-helpers.R @@ -113,11 +113,13 @@ ensure_model_column <- function(data) { #' If the number of quantiles or samples is the same for all forecasts, it #' returns TRUE and a string with an error message otherwise. #' @param forecast_unit Character vector denoting the unit of a single forecast. +#' @importFrom checkmate assert_subset #' @inherit document_check_functions params return #' @keywords internal_input_check check_number_per_forecast <- function(data, forecast_unit) { data <- ensure_data.table(data) data <- na.omit(data) + assert_subset(forecast_unit, colnames(data)) # check whether there are the same number of quantiles, samples -------------- data[, scoringutils_InternalNumCheck := length(predicted), by = forecast_unit] n <- unique(data$scoringutils_InternalNumCheck)