Add a product column to a muscle work data frame
specify_product.Rd
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,
species = MWTools::mw_constants$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
.- species
- human
See
MWTools::mw_species
.- stage, sector
- biomass, food, feed, hu_mech, an_mech, an_p
See
MWTools::mw_products
.- transport
See
MWTools::sectors
.
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,330 × 10
#> Country Year Species Stage Sector Unit E.dot Product Energy.type Method
#> <chr> <dbl> <chr> <chr> <chr> <chr> <dbl> <chr> <chr> <chr>
#> 1 GBR 1960 Human fe… Final Agric… EJ 8.68e-4 Food E PCM
#> 2 GBR 1960 Human fe… Final Indus… EJ 1.54e-2 Food E PCM
#> 3 GBR 1960 Human fe… Final Servi… EJ 2.82e-2 Food E PCM
#> 4 GBR 1960 Human fe… Prim… Agric… EJ 1.40e-3 Biomass E PCM
#> 5 GBR 1960 Human fe… Prim… Indus… EJ 2.48e-2 Biomass E PCM
#> 6 GBR 1960 Human fe… Prim… Servi… EJ 4.55e-2 Biomass E PCM
#> 7 GBR 1960 Human fe… Usef… Agric… EJ 4.16e-5 HuMech E PCM
#> 8 GBR 1960 Human fe… Usef… Indus… EJ 7.43e-4 HuMech E PCM
#> 9 GBR 1960 Human fe… Usef… Servi… EJ 4.77e-4 HuMech E PCM
#> 10 GBR 1960 Human ma… Final Agric… EJ 4.64e-3 Food E PCM
#> # ℹ 3,320 more rows