From 83efd3f774619a2519ced0325f3d0f9468dd88cc Mon Sep 17 00:00:00 2001 From: jvendries Date: Thu, 9 Nov 2023 21:05:15 -0500 Subject: [PATCH] In buildModelwithImportFactors function, found mismatch between original import and validation import was due to change in column order in validation import --- R/IOFunctions.R | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/R/IOFunctions.R b/R/IOFunctions.R index 7e84979a..beac0326 100644 --- a/R/IOFunctions.R +++ b/R/IOFunctions.R @@ -295,12 +295,17 @@ buildModelwithImportFactors <- function(model) { # # Check that import values are the same as the original import data # # Note that this check is not meant to be included in the code # Import <- get(paste("Summary_Import", model$specs$IOYear, "BeforeRedef", sep = "_"))*1E6 + # Import <- Import[,!names(Import) %in% c("T001", "T004")] # Remove t001 and t004 columns. + # Import <- Import[c(model$Industries$Code, model$FinalDemandMeta$Code)] # Reorder final demand columns to match final demand meta # rownames(Import) <-rownames(model$UseTransactions_m) # importColNames <- c(colnames(model$UseTransactions_m), colnames(model$DomesticFDWithITA)) # colnames(Import) <- importColNames - # temp <- model$UseTransactions_m - Import[,1:71] - # sum(sum(temp)) == 0 # should be TRUE - # #TODO: CHECK all.equal(model$ImportFinalDemand, Import[,72:93]), AND HOW ITA IS GENERATED AT LINE236 + # + # useCheck <- model$UseTransactions_m - Import[,1:71] + # sum(sum(useCheck)) == 0 # should be TRUE as should all.equal(model$UseTransactions_m, Import[,1:71]) + # + # importCheck <- model$ImportFinalDemand - Import[72:91] + # sum(sum(importCheck)) == 0 # should be TRUE as should all.equal(model$ImportFinalDemand, Import[,72:91]) return(model) }