verify_SUT_industry_production: Confirm that all Industries in an SUT-style data frame...

View source: R/energy_balance.R

verify_SUT_industry_productionR Documentation

Confirm that all Industries in an SUT-style data frame produce energy.

Description

If a transformation process industry consumes energy (in the U matrix) but does not make energy (in the V matrix), it is most certainly an error. (In contrast, there can be Industries that make energy but do not consume it, such as Industries involved in Production. And final demand sectors consume energy but do not produce any.) This function emits a warning if an Industry in the U matrix is found to consume energy but not make energy. Look at the industry_production_OK column of the output to see which rows of .sutmats exhibit the problem. Look at the problem_industries column of the output to see which industries exhibit this problem.

Usage

verify_SUT_industry_production(
  .sutmats = NULL,
  R = "R",
  U = "U",
  V = "V",
  industry_production_OK = ".industry_production_OK",
  problem_industries = ".problem_industries"
)

Arguments

.sutmats

an SUT-style data frame containing metadata columns (typically Country, Year, Ledger.side, Product, etc.) and columns of SUT matrices, including U and V.

R

resources (R) matrix or name of the column in .sutmats that contains same. Default is "R".

U

use (U) matrix or name of the column in .sutmats that contains same. Default is "U".

V

make (V) matrix or name of the column in .sutmatsthat contains same. Default is "V".

industry_production_OK

the name of the column in the output that tells whether all industries produce something. Default is ".industry_production_OK".

problem_industries

the name of the column in the output that tells which transformation processes consume energy but do not produce anything.

Value

.sutmats with added column named with the value of industry_production_OK.

Examples

library(tidyr)
verify_SUT_industry_production(UKEnergy2000mats %>%
                                 spread(key = matrix.name, value = matrix))

MatthewHeun/Recca documentation built on Feb. 9, 2024, 6:18 p.m.