diff --git a/R/CalculationFunctions.R b/R/CalculationFunctions.R index 5133efc5..2908a8ce 100644 --- a/R/CalculationFunctions.R +++ b/R/CalculationFunctions.R @@ -511,6 +511,9 @@ calculateSectorPurchasedbySectorSourcedImpact <- function (y, model, indicator) #' @return A list with M_margin and N_margin #' @export calculateMarginSectorImpacts <- function(model) { + if (model$specs$IODataSource == "stateior") { + stop("Margins not available for two-region models") + } # Calculation fractions of producer price for each margin MarginCoefficients <- as.matrix(model$Margins[, c("Transportation", "Wholesale", "Retail")]/model$Margins[, c("ProducersValue")]) rownames(MarginCoefficients) <- model$Margins$SectorCode diff --git a/R/LoadIOTables.R b/R/LoadIOTables.R index a8c30a03..163c39f8 100644 --- a/R/LoadIOTables.R +++ b/R/LoadIOTables.R @@ -41,8 +41,10 @@ loadIOData <- function(model, configpaths = NULL) { names(model$InternationalTradeAdjustment) <- model$Industries$Code_Loc } - # Add Margins table - model$Margins <- getMarginsTable(model) + if (model$specs$IODataSource != "stateior") { + # Add Margins table, currently only for one-region models (see Issue #290) + model$Margins <- getMarginsTable(model) + } # Add TaxLessSubsidies table model$TaxLessSubsidies <- generateTaxLessSubsidiesTable(model)