Rename muscle work sectors to comport with IEA sectors.
rename_mw_sectors.Rd
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.
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
#> # A tibble: 5 × 2
#> Sector value
#> <chr> <dbl>
#> 1 Transport 10
#> 2 Agriculture 11
#> 3 Services 12
#> 4 Industry 13
#> 5 bogus 14
rename_mw_sectors(df)
#> # A tibble: 5 × 2
#> Sector value
#> <chr> <dbl>
#> 1 Transport not elsewhere specified 10
#> 2 Agriculture/forestry 11
#> 3 Commercial and public services 12
#> 4 Industry not elsewhere specified 13
#> 5 bogus 14