Prep PFU data for conversion to PSUT matrices
add_row_col_meta.Rd
Primary-final-useful (PFU) data need to be converted to PSUT matrices.
This function take the output of specify_last_stages()
and converts to PSUT matrices in a data frame.
Usage
add_row_col_meta(
.df,
biomass = MWTools::mw_products$biomass,
food = MWTools::mw_products$food,
feed = MWTools::mw_products$feed,
hu_mech = MWTools::mw_products$hu_mech,
an_mech = MWTools::mw_products$an_mech,
an_p = MWTools::mw_products$an_p,
resources = MWTools::mw_sectors$resources_sector,
farms = MWTools::mw_sectors$farms,
food_production = MWTools::mw_sectors$food_production,
feed_production = MWTools::mw_sectors$feed_production,
transport = MWTools::mw_sectors$transport_sector,
human_females = MWTools::mw_species$human_females,
human_males = MWTools::mw_species$human_males,
final = MWTools::all_stages$final,
useful = MWTools::all_stages$useful,
species = MWTools::mw_constants$species,
sector = MWTools::mw_constants$sector_col,
stage = MWTools::mw_constants$stage_col,
product = MWTools::mw_cols$product,
last_stage = MWTools::mw_cols$last_stage,
matnames = MWTools::mat_meta_cols$matnames,
rownames = MWTools::mat_meta_cols$rownames,
colnames = MWTools::mat_meta_cols$colnames,
rowtypes = MWTools::mat_meta_cols$rowtypes,
coltypes = MWTools::mat_meta_cols$coltypes,
R_name = MWTools::psut_cols$R,
U_name = MWTools::psut_cols$U,
V_name = MWTools::psut_cols$V,
Y_name = MWTools::psut_cols$Y,
industry_type = MWTools::row_col_types$industry,
product_type = MWTools::row_col_types$product,
product_notation = RCLabels::from_notation,
resource_notation = RCLabels::of_notation,
species_notation = RCLabels::arrow_notation
)
Arguments
- .df
A data frame containing muscle work data, likely the output from
specify_last_stages()
.- biomass, food, feed, hu_mech, an_mech, an_p
See
MWTools::mw_products
.- resources, farms, food_production, feed_production, transport
- human_females, human_males
See
MWTools::mw_species
.- final, useful
See
MWTools::all_stages
.- species, sector, stage
- product, last_stage
See
MWTools::mw_cols
.- matnames, rownames, colnames, rowtypes, coltypes
- R_name, U_name, V_name, Y_name
See
MWTools::psut_cols
.- industry_type, product_type
- product_notation
The notation for products. Default is
RCLabels::from_notation
.- resource_notation
The notation for resources. Default is
RCLabels::of_notation
.- species_notation
The notation for species. Default is
RCLabels::arrow_notation
.
Examples
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()
amw_df <- amw_test_data_path() %>%
read.csv() %>%
calc_amw_pfu()
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()
#> # A tibble: 15,540 × 16
#> Country Year Species Stage Sector Unit E.dot Energy.type Method Product
#> <chr> <dbl> <chr> <chr> <chr> <chr> <dbl> <chr> <chr> <chr>
#> 1 GBR 1960 Human fem… Prim… Agric… TJ 1400. E PCM Biomas…
#> 2 GBR 1960 Human fem… Prim… Indus… TJ 24836. E PCM Biomas…
#> 3 GBR 1960 Human fem… Prim… Servi… TJ 45474. E PCM Biomas…
#> 4 GBR 1960 Human mal… Prim… Agric… TJ 7489. E PCM Biomas…
#> 5 GBR 1960 Human mal… Prim… Indus… TJ 91706. E PCM Biomas…
#> 6 GBR 1960 Human mal… Prim… Servi… TJ 60611. E PCM Biomas…
#> 7 GBR 1961 Human fem… Prim… Agric… TJ 1418. E PCM Biomas…
#> 8 GBR 1961 Human fem… Prim… Indus… TJ 25146. E PCM Biomas…
#> 9 GBR 1961 Human fem… Prim… Servi… TJ 46041. E PCM Biomas…
#> 10 GBR 1961 Human mal… Prim… Agric… TJ 7581. E PCM Biomas…
#> # ℹ 15,530 more rows
#> # ℹ 6 more variables: Last.stage <chr>, matnames <chr>, rownames <chr>,
#> # colnames <chr>, rowtypes <chr>, coltypes <chr>