From 3b43bdf3dd48f66ff06bca24842118a745c21802 Mon Sep 17 00:00:00 2001 From: antaldaniel Date: Thu, 28 Dec 2023 11:28:25 +0100 Subject: [PATCH] More meaningful error message with non-conforming matrixes. --- R/input_multipliers_create.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/R/input_multipliers_create.R b/R/input_multipliers_create.R index 6a93492..66afd1a 100644 --- a/R/input_multipliers_create.R +++ b/R/input_multipliers_create.R @@ -54,6 +54,13 @@ input_multipliers_create <- function ( input_requirements, key_column <- subset ( input_requirements, select = 1) input_requirements_matrix <- input_requirements[,-1] inverse <- Im[, -1] + + if(! all(names(input_requirements_matrix) %in% names(inverse))) { + mismatch_1 <- names(input_requirements_matrix)[which(!names(input_requirements_matrix) %in% names(inverse))] + mismatch_2 <- names(inverse)[which(!names(inverse) %in% names(input_requirements_matrix))] + stop("input_multipliers_create() error. Non-conforming matrixes: ", paste0(mismatch_1, mismatch_2), + " is not present in both input_requirements and Im.") + } inverse <- as.matrix ( inverse ) input_requirements_matrix <- as.matrix ( input_requirements_matrix )