View source: R/final_to_useful.R
stack_final_useful_df | R Documentation |
After a call to extend_to_useful()
,
the resulting data frame is not in a great shape.
This function gathers (via tidyr::pivot_longer()
)
and stacks the useful data beneath the final data.
A last_stage
column is added to discriminate between
final and useful versions of matrices.
stack_final_useful_df(
.useful_df,
.sutdata,
last_stage = IEATools::iea_cols$last_stage,
useful = IEATools::last_stages$useful,
.sep = "_",
C_eiou = IEATools::template_cols$C_eiou,
C_Y = IEATools::template_cols$C_Y,
eta_fu = IEATools::template_cols$eta_fu,
phi_u = IEATools::template_cols$phi_u,
U_feed_name = IEATools::psut_cols$U_feed,
U_eiou_name = IEATools::psut_cols$U_eiou,
U_name = IEATools::psut_cols$U,
r_eiou_name = IEATools::psut_cols$r_eiou,
V_name = IEATools::psut_cols$V,
Y_name = IEATools::psut_cols$Y
)
.useful_df |
A data frame created by |
.sutdata |
The original input to |
last_stage |
See |
useful |
See |
.sep |
A separator between matrix names and |
C_eiou , C_Y , eta_fu , phi_u |
See |
U_eiou_name , U_feed_name , U_name , r_eiou_name , V_name , Y_name |
See |
A nicer form of useful energy and exergy data.
C_data <- load_fu_allocation_data() %>%
form_C_mats()
eta_fu_data <- load_eta_fu_data() %>%
form_eta_fu_phi_u_vecs()
m_cols <- eta_fu_data %>%
IEATools::meta_cols(return_names = TRUE,
years_to_keep = IEATools::iea_cols$year,
not_meta = c(IEATools::template_cols$eta_fu,
IEATools::template_cols$phi_u))
psut_mats <- load_tidy_iea_df() %>%
specify_all() %>%
prep_psut()
extended_to_useful <- psut_mats |>
dplyr::full_join(C_data, by = m_cols) %>%
dplyr::full_join(eta_fu_data, by = m_cols) |>
extend_to_useful()
stack_final_useful_df(extended_to_useful, psut_mats)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.