View source: R/extend_to_exergy.R
calc_phi_pf_vecs | R Documentation |
This function creates a data frame that contains all the metadata columns
from phi_u_vecs
and a column of phi_pf vectors.
This work is accomplished by creating a vector from phi_constants
,
adding one instance of the vector to the right side of the phi_constants
data frame
for each row of the data frame,
and deleting phi_u_colname
from the data frame.
calc_phi_pf_vecs(
phi_constants,
phi_u_vecs,
countries,
matrix_class = c("matrix", "Matrix"),
country = IEATools::iea_cols$country,
product = IEATools::iea_cols$product,
eta_fu = IEATools::template_cols$eta_fu,
phi_u = IEATools::template_cols$phi_u,
phi_pf_colname = IEATools::template_cols$phi_pf,
phi_colname = IEATools::phi_constants_names$phi_colname,
is_useful_colname = IEATools::phi_constants_names$is_useful_colname
)
phi_constants |
A data frame of constant phi values (for primary, final, and useful stages)
with columns |
phi_u_vecs |
A data frame containing metadata columns and a column of phi_u vectors. A column of phi_pf vectors replaces the column of phi_u vectors on output. |
countries |
The countries for which you want to perform this task. |
matrix_class |
A string that tells which type of matrix to create, a "matrix" (the built-in type) or a "Matrix" (could be sparse). Default is "matrix". |
country, product |
See |
eta_fu, phi_u, phi_pf_colname |
See |
phi_colname, is_useful_colname |
See |
A version of the phi_constants
data frame
with the column of useful phi (useful exergy-to-energy ratio) vectors
replaced by a column of primary and final phi vectors.
phi_constants <- IEATools::sample_phi_constants_path() %>%
IEATools::load_phi_constants_table()
phi_u_vecs <- tibble::tibble(Country = "GHA",
Year = 1971,
rownames = c("Light", "MD"),
colnames = "col",
matnames = "phi.u",
matvals = c(0.8, 0.9),
rowtypes = "rowtype",
coltypes = "coltype") %>%
dplyr::group_by(Country, Year) %>%
matsindf::collapse_to_matrices() %>%
dplyr::rename(phi.u = matvals) %>%
dplyr::mutate(
Quantity = NULL
)
calc_phi_pf_vecs(phi_constants, phi_u_vecs, countries = "GHA")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.