calc_S_units | R Documentation |
The S_units
vector is a unit summation vector
with products (energy carriers) in rows and units in columns.
The row names for each vector are the various products in that row of .df
.
The column names for each vector are taken from the units
column of .df
.
calc_S_units(
.df = NULL,
matrix_class = c("matrix", "Matrix"),
unit = MWTools::mw_cols$unit,
R = MWTools::psut_cols$R,
U = MWTools::psut_cols$U,
V = MWTools::psut_cols$V,
Y = MWTools::psut_cols$Y,
s_units = MWTools::psut_cols$s_units,
product_notation = RCLabels::from_notation,
product_type = MWTools::row_col_types$product,
unit_type = MWTools::row_col_types$unit
)
.df |
A data frame. Default is |
matrix_class |
The type of matrix to be created, one of "matrix" or "Matrix". Default is "matrix". |
unit |
A string unit for each row or the name of the unit column in |
R , U , V , Y |
PSUT matrices or the names of matrix columns in |
s_units |
The name of the output matrix or the output column. See |
product_notation |
Notation for products. Default is |
product_type , unit_type |
The types for products and units columns. See |
This function employs matsindf::matsindf_apply()
internally, so
unit
can be a single string or the name of a column in .df
.
Similarly, R
, U
, V
, and Y
can be either matrices or the names of columns in .df
.
Product names are taken from the prefixes of row or columns names
of the R
, U
, V
, and Y
matrices.
The unit
column will remain in .df
on output and will need to be deleted afterward.
.df
with an s_units
column added.
ilo_working_hours_data <- read.csv(file = MWTools::ilo_working_hours_test_data_path())
ilo_employment_data <- read.csv(file = MWTools::ilo_employment_test_data_path())
hmw_data <- prepareRawILOData(ilo_working_hours_data = ilo_working_hours_data,
ilo_employment_data = ilo_employment_data)
hmw_df <- hmw_data %>%
calc_hmw_pfu() %>%
# Keep only a few years for speed.
dplyr::filter(Year %in% 2000:2002)
amw_df <- amw_test_data_path() %>%
read.csv() %>%
calc_amw_pfu() %>%
# Keep only a few years for speed.
dplyr::filter(Year %in% 2000:2002)
specify_energy_type_method(hmw_df, amw_df) %>%
specify_product() %>%
specify_TJ() %>%
MWTools::specify_primary_production() %>%
specify_useful_products() %>%
specify_fu_machines() %>%
specify_last_stages() %>%
MWTools::add_row_col_meta() %>%
MWTools::collapse_to_psut() %>%
calc_S_units()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.