rename_mw_sectors: Rename muscle work sectors to comport with IEA sectors.

View source: R/mw_functions.R

rename_mw_sectorsR Documentation

Rename muscle work sectors to comport with IEA sectors.

Description

The muscle work methodology in the MWTools package uses slightly different final demand sector names compared to the IEA and the IEATools package.. This function converts the MWTools sector names to appropriate IEA sector names.

Usage

rename_mw_sectors(
  .df,
  sector_colname = MWTools::mw_constants$sector_col,
  original_sector_names = c(MWTools::mw_sectors$agriculture_broad.sector,
    MWTools::mw_sectors$transport_sector, MWTools::mw_sectors$services_broad.sector,
    MWTools::mw_sectors$industry_broad.sector),
  new_sector_names = c(IEATools::other_flows$agriculture_forestry,
    IEATools::transport_flows$transport_not_elsewhere_specified,
    IEATools::other_flows$commercial_and_public_services,
    IEATools::industry_flows$industry_not_elsewhere_specified)
)

Arguments

.df

A data frame of muscle work data.

sector_colname

The name of the sector column. Default is MWTools::mw_constants$sector_col.

original_sector_names

A vector of string sector names that will be replaced.

new_sector_names

A vector of string sector names that will appear in output.

Value

A data frame with renamed sectors.

Examples

df <- tibble::tribble(~Sector, ~value, 
                      MWTools::mw_sectors$transport_sector,         10, 
                      MWTools::mw_sectors$agriculture_broad.sector, 11,
                      MWTools::mw_sectors$services_broad.sector,    12,
                      MWTools::mw_sectors$industry_broad.sector,    13, 
                      "bogus",                                      14)
df
rename_mw_sectors(df)

EnergyEconomyDecoupling/PFUDatabase documentation built on Feb. 8, 2024, 8:45 a.m.