Skip to contents

A product column is needed before converting a muscle work data frame to PSUT matrices. This function adds and populates the product column.

Usage

specify_product(
  .df,
  product = MWTools::mw_cols$product,
  primary = MWTools::all_stages$primary,
  final = MWTools::all_stages$final,
  useful = MWTools::all_stages$useful,
  concordance_species = MWTools::conc_cols$species,
  human = MWTools::mw_species$human,
  stage = MWTools::mw_constants$stage_col,
  sector = MWTools::mw_constants$sector_col,
  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,
  transport = MWTools::mw_sectors$transport_sector
)

Arguments

.df

A data frame, likely produced by specify_energy_type_method().

product

The name of the column to be added. See MWTools::mw_constants.

primary, final, useful

See MWTools::all_stages.

concordance_species

See MWTools::conc_cols.

human

See MWTools::mw_species.

stage, sector

See MWTools::mw_constants.

biomass, food, feed, hu_mech, an_mech, an_p

See MWTools::mw_products.

transport

See MWTools::sectors.

Value

A data frame with additional rows needed for converting to PSUT matrices.

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() %>%
  specify_product()
amw_df <- amw_test_data_path() %>%
  read.csv() %>%
  calc_amw_pfu()
specify_energy_type_method(hmw_df, amw_df) %>%
  specify_product()
#> # A tibble: 3,366 × 10
#>    Country  Year Species    Stage Sector Unit     Edot Product EnergyType Method
#>    <chr>   <dbl> <chr>      <chr> <chr>  <chr>   <dbl> <chr>   <chr>      <chr> 
#>  1 GBR      1960 Human fem… Final Agric… EJ    8.68e-4 Food    E          PCM   
#>  2 GBR      1960 Human fem… Final Indus… EJ    1.54e-2 Food    E          PCM   
#>  3 GBR      1960 Human fem… Final Servi… EJ    2.82e-2 Food    E          PCM   
#>  4 GBR      1960 Human fem… Prim… Agric… EJ    1.40e-3 Biomass E          PCM   
#>  5 GBR      1960 Human fem… Prim… Indus… EJ    2.48e-2 Biomass E          PCM   
#>  6 GBR      1960 Human fem… Prim… Servi… EJ    4.55e-2 Biomass E          PCM   
#>  7 GBR      1960 Human fem… Usef… Agric… EJ    4.16e-5 HuMech  E          PCM   
#>  8 GBR      1960 Human fem… Usef… Indus… EJ    7.43e-4 HuMech  E          PCM   
#>  9 GBR      1960 Human fem… Usef… Servi… EJ    4.77e-4 HuMech  E          PCM   
#> 10 GBR      1960 Human mal… Final Agric… EJ    4.64e-3 Food    E          PCM   
#> # ℹ 3,356 more rows