Skip to content

Commit

Permalink
More meaningful error message with non-conforming matrixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
antaldaniel committed Dec 28, 2023
1 parent d2aebea commit 3b43bdf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions R/input_multipliers_create.R
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down

0 comments on commit 3b43bdf

Please sign in to comment.