sum_phi_vecs: Sums phi_pf and phi_u vectors

View source: R/extend_to_exergy.R

sum_phi_vecsR Documentation

Sums phi_pf and phi_u vectors

Description

This function verifies that there are no rows in common between the two input vectors.

Usage

sum_phi_vecs(
  phi_pf_vecs,
  phi_u_vecs,
  countries,
  country = IEATools::iea_cols$country,
  last_stage = IEATools::iea_cols$last_stage,
  energy_type = IEATools::iea_cols$energy_type,
  method = IEATools::iea_cols$method,
  phi_pf_colname = IEATools::template_cols$phi_pf,
  phi_u_colname = IEATools::template_cols$phi_u,
  phi_colname = IEATools::phi_constants_names$phi_colname,
  .nrow_diffs = ".nrow_diffs",
  .phi_shape_OK = ".phi_shape_OK",
  .phi_names_OK = ".phi_names_OK",
  .phi_cols_OK = ".phi_cols_OK",
  .phi_sum_OK = ".phi_sum_OK",
  .phi_pf_colnames = ".phi_pf_colnames",
  .phi_u_colnames = ".phi_u_colnames"
)

Arguments

phi_pf_vecs

A data frame of phi_pf vectors.

phi_u_vecs

A data frame of phi_u vectors.

countries

The countries for which you want to perform this task.

country, last_stage, energy_type, method

See IEATools::iea_cols.

phi_pf_colname, phi_u_colname

See IEATools::template_cols.

phi_colname

See IEATools::phi_constants_names.

.nrow_diffs, .phi_shape_OK, .phi_names_OK, .phi_cols_OK, .phi_sum_OK, .phi_pf_colnames, .phi_u_colnames

Names of temporary error-checking columns created internally.

Value

A data frame of summed phi_pf and phi_u vectors.

Examples

phi_pf_vec <- matrix(c(1.1,
                       1.05), nrow = 2, ncol = 1,
                     dimnames = list(c("Coal", "Oil"), "phi"))
# Make a data frame of phi_pf vectors
phi_pf <- tibble::tibble(phi.pf = matsbyname::make_list(phi_pf_vec, n = 2, lenx = 1),
                         Country = "GHA",
                         Year = c(1971, 2000))
phi_u_vec <- matrix(c(0.8,
                      0.9,
                      0.7), nrow = 3, ncol = 1,
                    dimnames = list(c("Light", "MD", "Propulsion"), "phi"))
phi_u <- tibble::tibble(phi.u = matsbyname::make_list(phi_u_vec, n = 2, lenx = 1),
                        Country = "GHA",
                        Year = c(1971, 2000))
sum_phi_vecs(phi_pf, phi_u, countries = "GHA")

MatthewHeun/SEAPSUTWorkflow documentation built on April 22, 2022, 2:21 p.m.