specify_product: Add a product column to a muscle work data frame

View source: R/specify.R

specify_productR Documentation

Add a product column to a muscle work data frame

Description

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()

EnergyEconomyDecoupling/MWTools documentation built on April 14, 2025, 9:27 a.m.