Create energy conversion chains for final and useful last stages
specify_last_stages.Rd
We have two ways to describe the energy conversion chain:
with last stage of "Final" and last stage of "Useful".
This function takes .df
(assumed to be last_stage = "Useful"
)
and converts to last_stage = "Final"
by adding a last_stage column with appropriate values.
Usage
specify_last_stages(
.df,
stage = MWTools::mw_constants$stage_col,
last_stage = MWTools::mw_cols$last_stage,
final = MWTools::last_stages$final,
useful = MWTools::last_stages$useful
)
Arguments
- .df
A data frame, probably the output of
specify_fu_machines()
.- stage
- last_stage
See
MWTools::mw_cols
.- final, useful
See
MWTools::last_stages
.
Value
A data frame containing a new column last_stage
and
rows for both final and useful being the last stage.
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() %>%
MWTools::specify_primary_production() %>%
specify_useful_products() %>%
specify_fu_machines() %>%
specify_last_stages()
#> # A tibble: 7,854 × 11
#> Country Year Species Stage Sector Unit Edot EnergyType Method Product
#> <chr> <dbl> <chr> <chr> <chr> <chr> <dbl> <chr> <chr> <chr>
#> 1 GBR 1960 Human fem… Final Agric… EJ 8.68e-4 E PCM Food
#> 2 GBR 1960 Human fem… Final Indus… EJ 1.54e-2 E PCM Food
#> 3 GBR 1960 Human fem… Final Servi… EJ 2.82e-2 E PCM Food
#> 4 GBR 1960 Human fem… Prim… Agric… EJ 1.40e-3 E PCM Biomass
#> 5 GBR 1960 Human fem… Prim… Indus… EJ 2.48e-2 E PCM Biomass
#> 6 GBR 1960 Human fem… Prim… Servi… EJ 4.55e-2 E PCM Biomass
#> 7 GBR 1960 Human mal… Final Agric… EJ 4.64e-3 E PCM Food
#> 8 GBR 1960 Human mal… Final Indus… EJ 5.69e-2 E PCM Food
#> 9 GBR 1960 Human mal… Final Servi… EJ 3.76e-2 E PCM Food
#> 10 GBR 1960 Human mal… Prim… Agric… EJ 7.49e-3 E PCM Biomass
#> # ℹ 7,844 more rows
#> # ℹ 1 more variable: LastStage <chr>