Title: | Easily Install and Load 'PACTA' for Banks Packages |
---|---|
Description: | 'PACTA' for Banks is a tool that allows banks to calculate the climate alignment of their corporate lending portfolios. This package is designed to make it easy to install and load multiple 'PACTA' for Banks packages in a single step. It also provides thorough documentation - the 'PACTA' for Banks cookbook - on how to run a 'PACTA' for Banks analysis. This covers prerequisites for the analysis, the separate steps of running the analysis, the interpretation of 'PACTA' for Banks results, and advanced use cases. |
Authors: | Jacob Kastl [aut, cre, ctr] |
Maintainer: | Jacob Kastl <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2025-03-10 16:18:55 UTC |
Source: | https://github.com/rmi-pacta/pacta.loanbook |
Fake data about physical assets (e.g. wind turbine power plant capacities), aggregated to company-level. These data are used to assess the climate alignment of financial portfolios. It imitates data from market-intelligence databases.
Demo datasets are synthetic because most financial data is strictly private; they help to demonstrate and test the implementation in R of 'PACTA' (https://www.transitionmonitor.com/).
abcd_demo
abcd_demo
An object of class tbl_df
(inherits from tbl
, data.frame
) with 4972 rows and 12 columns.
company_id
(character): The id of the company owning the asset created by the data provider., * emission_factor
(double): Company level emission factor of the technology., * emission_factor_unit
(character): The units that the emission factor is measured in., * is_ultimate_owner
(logical): Flag if company is the ultimate parent in our database., * lei
(character): The legal entity identifier of the company owning the asset., * name_company
(character): The name of the company owning the asset., * plant_location
(character): Country where asset is located., * production
(double): Company level production of the technology., * production_unit
(character): The units that production is measured in., * sector
(character): Sector to which the asset belongs., * technology
(character): Technology implemented by the asset., * year
(integer): Year at which the production value is predicted.
Other demo data:
co2_intensity_scenario_demo
,
loanbook_demo
,
market_share
,
overwrite_demo
,
region_isos_demo
,
scenario_demo_2020
,
sda
head(abcd_demo)
head(abcd_demo)
Fake CO2 intensity climate scenario dataset, prepared for the software PACTA (Paris Agreement Capital Transition Assessment). It imitates climate scenario data (e.g. from the International Energy Agency (IEA)) including the change through time in production across industrial sectors.
Demo datasets are synthetic because most financial data is strictly private; they help to demonstrate and test the implementation in R of 'PACTA' (https://www.transitionmonitor.com/).
co2_intensity_scenario_demo
co2_intensity_scenario_demo
An object of class tbl_df
(inherits from tbl
, data.frame
) with 22 rows and 7 columns.
emission_factor
(double): The target sector level emissions factor that the scenario prescribes., * emission_factor_unit
(character): The units that the emissions factor is measured in., * region
(character): The region to which the pathway is relevant., * scenario
(character): The name of the scenario., * scenario_source
(character): The source publication from which the scenario was taken., * sector
(character): The sector to which the scenario prescribes a pathway., * year
(integer): The year at which the pathway value is prescribed.
Other demo data:
abcd_demo
,
loanbook_demo
,
market_share
,
overwrite_demo
,
region_isos_demo
,
scenario_demo_2020
,
sda
head(co2_intensity_scenario_demo)
head(co2_intensity_scenario_demo)
loanbook
columns for match_name()
This is a helper to select the minimum loanbook
columns you need to run
match_name()
. Using more columns may use too much time and memory.
crucial_lbk()
crucial_lbk()
A character vector.
Other matching functions:
match_name()
,
prioritize()
,
prioritize_level()
crucial_lbk()
crucial_lbk()
A table of column names and descriptions of data frames used or exported by the functions in this package.
data_dictionary
data_dictionary
data_dictionary
Name of the dataset
Name of the column
Type of the column
Definition of the column
data_dictionary
data_dictionary
This dataset serves as a translation key between common sector-classification systems and sectors relevant to the 'PACTA' tool (https://www.transitionmonitor.com/).
gics_classification
gics_classification
An object of class tbl_df
(inherits from tbl
, data.frame
) with 282 rows and 5 columns.
borderline
(logical): Flag indicating if PACTA sector and classification code are a borderline match. The value TRUE indicates that the match is uncertain between the PACTA sector and the classification. The value FALSE indicates that the match is certainly perfect or the classification is certainly out of PACTA's scope.., * code
(character): Original GICS code., * description
(character): Original GICS description., * sector
(character): Associated PACTA sector., * version
(character): Column identifying to which GICS version the code belongs.
Classification datasets help to standardize sector classification codes from the wild to a relevant subset including 'power', 'oil and gas', 'coal', 'automotive', 'aviation', 'concrete', 'steel', and 'shipping'.
Other datasets:
increasing_or_decreasing
,
isic_classification
,
iso_codes
,
nace_classification
,
naics_classification
,
palette_colours
,
psic_classification
,
region_isos
,
scenario_colours
,
sector_classifications
,
sector_colours
,
sic_classification
,
technology_colours
head(gics_classification)
head(gics_classification)
This dataset provides a simple lookup table to determine if a technology is meant to increase or decrease to align with a scenario that predicts a less than 2 degree temperature rise.
increasing_or_decreasing
increasing_or_decreasing
An object of class tbl_df
(inherits from tbl
, data.frame
) with 20 rows and 3 columns.
increasing_or_decreasing
(character): If the technology is increasing or decreasing, as defined by the Paris-aligned IEA scenarios., * sector
(character): The sector to which the technology belongs., * technology
(character): The technology sub-category within the sector.
Other datasets:
gics_classification
,
isic_classification
,
iso_codes
,
nace_classification
,
naics_classification
,
palette_colours
,
psic_classification
,
region_isos
,
scenario_colours
,
sector_classifications
,
sector_colours
,
sic_classification
,
technology_colours
head(increasing_or_decreasing)
head(increasing_or_decreasing)
This dataset serves as a translation key between common sector-classification systems and sectors relevant to the 'PACTA' tool (https://www.transitionmonitor.com/).
isic_classification
isic_classification
An object of class tbl_df
(inherits from tbl
, data.frame
) with 830 rows and 6 columns.
borderline
(logical): Flag indicating if PACTA sector and classification code are a borderline match. The value TRUE indicates that the match is uncertain between the PACTA sector and the classification. The value FALSE indicates that the match is certainly perfect or the classification is certainly out of PACTA's scope.., * code
(character): ISIC Rev 5 code with top-level letter prepended., * description
(character): Original ISIC Rev 5 title., * original_code
(character): Original ISIC Rev 5 code., * revision
(character): Column identifying to which ISIC revision the code belongs.., * sector
(character): Associated PACTA sector.
Classification datasets help to standardize sector classification codes from the wild to a relevant subset including 'power', 'oil and gas', 'coal', 'automotive', 'aviation', 'concrete', 'steel', and 'shipping'.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
iso_codes
,
nace_classification
,
naics_classification
,
palette_colours
,
psic_classification
,
region_isos
,
scenario_colours
,
sector_classifications
,
sector_colours
,
sic_classification
,
technology_colours
head(isic_classification)
head(isic_classification)
This dataset maps countries to codes.
For information about the ISO standard for country codes see https://www.iso.org/iso-3166-country-codes.html.
iso_codes
iso_codes
An object of class tbl_df
(inherits from tbl
, data.frame
) with 286 rows and 2 columns.
country
(character): Country name., * country_iso
(character): Corresponding ISO code.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
isic_classification
,
nace_classification
,
naics_classification
,
palette_colours
,
psic_classification
,
region_isos
,
scenario_colours
,
sector_classifications
,
sector_colours
,
sic_classification
,
technology_colours
head(iso_codes)
head(iso_codes)
Fake financial portfolio.
Demo datasets are synthetic because most financial data is strictly private; they help to demonstrate and test the implementation in R of 'PACTA' (https://www.transitionmonitor.com/).
loanbook_demo
loanbook_demo
An object of class tbl_df
(inherits from tbl
, data.frame
) with 283 rows and 13 columns.
id_direct_loantaker
(character): Borrower identifier unique to each borrower/sector combination in loanbook., * id_loan
(character): Unique loan identifier., * id_ultimate_parent
(character): Ultimate parent identifier unique to each ultimate parent/sector combination., * isin_direct_loantaker
(logical): Optional input: providing the isin identifier of the direct loan taker to improve the matching coverage., * lei_direct_loantaker
(logical): Optional input: providing the lei (legal entity identifier) of the direct loan taker to improve the matching coverage., * loan_size_credit_limit
(double): Total credit limit or exposure at default., * loan_size_credit_limit_currency
(character): Currency corresponding to credit limit., * loan_size_outstanding
(double): Amount drawn by borrower from total credit limit., * loan_size_outstanding_currency
(character): Currency corresponding to outstandings., * name_direct_loantaker
(character): Name of the company directly taking the loan., * name_ultimate_parent
(character): Name of the ultimate parent company to which the borrower belongs. Can be the same as borrower., * sector_classification_direct_loantaker
(double): Sector classification code of the direct loantaker., * sector_classification_system
(character): Name of the sector classification standard being used.
Other demo data:
abcd_demo
,
co2_intensity_scenario_demo
,
market_share
,
overwrite_demo
,
region_isos_demo
,
scenario_demo_2020
,
sda
head(loanbook_demo)
head(loanbook_demo)
name_*
columnsmatch_name()
scores the match between names in a loanbook dataset (columns
can be name_direct_loantaker
, name_intermediate_parent*
and
name_ultimate_parent
) with names in an asset-based company data (column
name_company
). The raw names are first internally transformed, and aliases
are assigned. The similarity between aliases in each of the loanbook and abcd
is scored using stringdist::stringsim()
.
match_name( loanbook, abcd, by_sector = TRUE, min_score = 0.8, method = "jw", p = 0.1, overwrite = NULL, join_id = NULL, sector_classification = default_sector_classification(), ... )
match_name( loanbook, abcd, by_sector = TRUE, min_score = 0.8, method = "jw", p = 0.1, overwrite = NULL, join_id = NULL, sector_classification = default_sector_classification(), ... )
loanbook , abcd
|
data frames structured like r2dii.data::loanbook_demo and r2dii.data::abcd_demo. |
by_sector |
Should names only be compared if companies belong to the
same |
min_score |
A number between 0-1, to set the minimum |
method |
Method for distance calculation. One of |
p |
Prefix factor for Jaro-Winkler distance. The valid range for
|
overwrite |
A data frame used to overwrite the |
join_id |
A join specification passed to |
sector_classification |
A data frame containing sector classifications
in the same format as |
... |
Arguments passed on to |
A data frame with the same groups (if any) and columns as loanbook
,
and the additional columns:
id_2dii
- an id used internally by match_name()
to distinguish
companies
level
- the level of granularity that the loan was matched at
(e.g direct_loantaker
or ultimate_parent
)
sector
- the sector of the loanbook
company
sector_abcd
- the sector of the abcd
company
name
- the name of the loanbook
company
name_abcd
- the name of the abcd
company
score
- the score of the match (manually set this to 1
prior to calling prioritize()
to validate the match)
source
- determines the source of the match. (equal to loanbook
unless the match is from overwrite
The returned rows depend on the argument min_value
and the result of the
column score
for each loan: * If any row has score
equal to 1,
match_name()
returns all rows where score
equals 1, dropping all other
rows. * If no row has score
equal to 1,match_name()
returns all rows
where score
is equal to or greater than min_score
. * If there is no
match the output is a 0-row tibble with the expected column names – for
type stability.
The transformation process used to compare names between loanbook and abcd datasets applies best practices commonly used in name matching algorithms:
Remove special characters.
Replace language specific characters.
Abbreviate certain names to reduce their importance in the matching.
Spell out numbers to increase their importance.
This function ignores but preserves existing groups.
Other matching functions:
crucial_lbk()
,
prioritize()
,
prioritize_level()
## Not run: library(r2dii.data) library(tibble) # Small data for examples loanbook <- head(loanbook_demo, 50) abcd <- head(abcd_demo, 50) match_name(loanbook, abcd) match_name(loanbook, abcd, min_score = 0.9) # match on LEI loanbook <- tibble( sector_classification_system = "NACE", sector_classification_direct_loantaker = "D35.11", id_ultimate_parent = "UP15", name_ultimate_parent = "Won't fuzzy match", id_direct_loantaker = "C294", name_direct_loantaker = "Won't fuzzy match", lei_direct_loantaker = "LEI123" ) abcd <- tibble( name_company = "alpine knits india pvt. limited", sector = "power", lei = "LEI123" ) match_name(loanbook, abcd, join_id = c(lei_direct_loantaker = "lei")) # Use your own `sector_classifications` your_classifications <- tibble( sector = "power", borderline = FALSE, code = "D35.11", code_system = "XYZ" ) loanbook <- tibble( sector_classification_system = "XYZ", sector_classification_direct_loantaker = "D35.11", id_ultimate_parent = "UP15", name_ultimate_parent = "Alpine Knits India Pvt. Limited", id_direct_loantaker = "C294", name_direct_loantaker = "Yuamen Xinneng Thermal Power Co Ltd" ) abcd <- tibble( name_company = "alpine knits india pvt. limited", sector = "power" ) match_name(loanbook, abcd, sector_classification = your_classifications) # Cleanup options(restore) ## End(Not run)
## Not run: library(r2dii.data) library(tibble) # Small data for examples loanbook <- head(loanbook_demo, 50) abcd <- head(abcd_demo, 50) match_name(loanbook, abcd) match_name(loanbook, abcd, min_score = 0.9) # match on LEI loanbook <- tibble( sector_classification_system = "NACE", sector_classification_direct_loantaker = "D35.11", id_ultimate_parent = "UP15", name_ultimate_parent = "Won't fuzzy match", id_direct_loantaker = "C294", name_direct_loantaker = "Won't fuzzy match", lei_direct_loantaker = "LEI123" ) abcd <- tibble( name_company = "alpine knits india pvt. limited", sector = "power", lei = "LEI123" ) match_name(loanbook, abcd, join_id = c(lei_direct_loantaker = "lei")) # Use your own `sector_classifications` your_classifications <- tibble( sector = "power", borderline = FALSE, code = "D35.11", code_system = "XYZ" ) loanbook <- tibble( sector_classification_system = "XYZ", sector_classification_direct_loantaker = "D35.11", id_ultimate_parent = "UP15", name_ultimate_parent = "Alpine Knits India Pvt. Limited", id_direct_loantaker = "C294", name_direct_loantaker = "Yuamen Xinneng Thermal Power Co Ltd" ) abcd <- tibble( name_company = "alpine knits india pvt. limited", sector = "power" ) match_name(loanbook, abcd, sector_classification = your_classifications) # Cleanup options(restore) ## End(Not run)
This dataset serves as a translation key between common sector-classification systems and sectors relevant to the 'PACTA' tool (https://www.transitionmonitor.com/).
nace_classification
nace_classification
An object of class tbl_df
(inherits from tbl
, data.frame
) with 1047 rows and 6 columns.
borderline
(logical): Flag indicating if PACTA sector and classification code are a borderline match. The value TRUE indicates that the match is uncertain between the PACTA sector and the classification. The value FALSE indicates that the match is certainly perfect or the classification is certainly out of PACTA's scope., * code
(character): NACE version 2.1 code with top-level letter prepended., * description
(character): Original NACE version 2.1 description., * original_code
(character): Original NACE version 2.1 code., * sector
(character): Associated PACTA sector., * version
(character): Column identifying to which NACE version the code belongs.
Classification datasets help to standardize sector classification codes from the wild to a relevant subset including 'power', 'oil and gas', 'coal', 'automotive', 'aviation', 'concrete', 'steel', and 'shipping'.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
isic_classification
,
iso_codes
,
naics_classification
,
palette_colours
,
psic_classification
,
region_isos
,
scenario_colours
,
sector_classifications
,
sector_colours
,
sic_classification
,
technology_colours
head(nace_classification)
head(nace_classification)
This dataset serves as a translation key between common sector-classification systems and sectors relevant to the 'PACTA' tool (https://www.transitionmonitor.com/).
naics_classification
naics_classification
An object of class tbl_df
(inherits from tbl
, data.frame
) with 2125 rows and 5 columns.
borderline
(logical): Flag indicating if PACTA sector and classification code are a borderline match. The value TRUE indicates that the match is uncertain between the PACTA sector and the classification. The value FALSE indicates that the match is certainly perfect or the classification is certainly out of PACTA's scope.., * code
(character): Six-digit NAICS code., * description
(character): Original NAICS sector title., * sector
(character): Associated PACTA sector., * version
(character): Column identifying which year the classification was published in..
Classification datasets help to standardize sector classification codes from the wild to a relevant subset including 'power', 'oil and gas', 'coal', 'automotive', 'aviation', 'concrete', 'steel', and 'shipping'.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
isic_classification
,
iso_codes
,
nace_classification
,
palette_colours
,
psic_classification
,
region_isos
,
scenario_colours
,
sector_classifications
,
sector_colours
,
sic_classification
,
technology_colours
head(naics_classification)
head(naics_classification)
Fake dataset used to manually link loanbook entities to mismatched asset level entities.
Demo datasets are synthetic because most financial data is strictly private; they help to demonstrate and test the implementation in R of 'PACTA' (https://www.transitionmonitor.com/).
overwrite_demo
overwrite_demo
An object of class tbl_df
(inherits from tbl
, data.frame
) with 2 rows and 5 columns.
id_2dii
(character): IDs of the entities to overwrite., * level
(character): Which level should be overwritten (e.g. direct_loantaker or ultimate_parent)., * name
(character): Overwrite name (if only overwriting sector, type NA)., * sector
(character): Overwrite sector (if only overwriting name, type NA)., * source
(character): What is the source of this information (leave as "manual" for now, may remove this flag later).
Other demo data:
abcd_demo
,
co2_intensity_scenario_demo
,
loanbook_demo
,
market_share
,
region_isos_demo
,
scenario_demo_2020
,
sda
head(overwrite_demo)
head(overwrite_demo)
{pacta.loanbook}
and other packagesThis function lists all the conflicts between packages in the
{pacta.loanbook}
and other packages that you have loaded.
pacta_loanbook_conflicts(only = NULL)
pacta_loanbook_conflicts(only = NULL)
only |
Set this to a character vector to restrict to conflicts only with these packages. |
There are four conflicts that are deliberately ignored: intersect
,
union
, setequal
, and setdiff
from dplyr. These functions
make the base equivalents generic, so shouldn't negatively affect any
existing code.
a pacta_loanbook_conflicts
classed list which will print a list of
conflicts to the console in interactive sessions, or NULL
if no conflicts
are found.
Other utility functions:
pacta_loanbook_deps()
,
pacta_loanbook_logo()
,
pacta_loanbook_packages()
,
pacta_loanbook_sitrep()
,
pacta_loanbook_update()
pacta_loanbook_conflicts()
pacta_loanbook_conflicts()
{pacta.loanbook}
dependenciesList all {pacta.loanbook}
dependencies
pacta_loanbook_deps(recursive = FALSE, repos = getOption("repos"))
pacta_loanbook_deps(recursive = FALSE, repos = getOption("repos"))
recursive |
If |
repos |
The repositories to use to check for updates.
Defaults to |
a tibble
containing the local and CRAN versions of dependent
packages.
Other utility functions:
pacta_loanbook_conflicts()
,
pacta_loanbook_logo()
,
pacta_loanbook_packages()
,
pacta_loanbook_sitrep()
,
pacta_loanbook_update()
## Not run: pacta_loanbook_deps() ## End(Not run)
## Not run: pacta_loanbook_deps() ## End(Not run)
{pacta.loanbook}
logo, using ASCII or Unicode charactersUse cli::ansi_strip()
to get rid of the colors.
pacta_loanbook_logo(unicode = cli::is_utf8_output())
pacta_loanbook_logo(unicode = cli::is_utf8_output())
unicode |
Whether to use Unicode symbols. Default is |
a pacta_loanbook_logo
classed cli_ansi_string
which will print
the PACTA logo in the console in interactive sessions.
Other utility functions:
pacta_loanbook_conflicts()
,
pacta_loanbook_deps()
,
pacta_loanbook_packages()
,
pacta_loanbook_sitrep()
,
pacta_loanbook_update()
pacta_loanbook_logo()
pacta_loanbook_logo()
{pacta.loanbook}
List all packages in {pacta.loanbook}
pacta_loanbook_packages(include_self = TRUE)
pacta_loanbook_packages(include_self = TRUE)
include_self |
Include |
a character vector containing the names of packages imported by
{pacta.loanbook}
.
Other utility functions:
pacta_loanbook_conflicts()
,
pacta_loanbook_deps()
,
pacta_loanbook_logo()
,
pacta_loanbook_sitrep()
,
pacta_loanbook_update()
pacta_loanbook_packages()
pacta_loanbook_packages()
{pacta.loanbook}
This function gives a quick overview of the versions of R and RStudio as well
as the {pacta.loanbook}
package. It's primarily designed to help you get a
quick idea of what's going on when you're helping someone else debug a
problem.
pacta_loanbook_sitrep()
pacta_loanbook_sitrep()
returns NULL
invisibly. The function is called for its side effect
of printing a situation report of {pacta.loanbook}
and its core packages.
Other utility functions:
pacta_loanbook_conflicts()
,
pacta_loanbook_deps()
,
pacta_loanbook_logo()
,
pacta_loanbook_packages()
,
pacta_loanbook_update()
## Not run: pacta_loanbook_sitrep() ## End(Not run)
## Not run: pacta_loanbook_sitrep() ## End(Not run)
{pacta.loanbook}
packagesThis will check to see if all {pacta.loanbook}
packages (and optionally,
their dependencies) are up-to-date, and will install after an interactive
confirmation.
pacta_loanbook_update(recursive = FALSE, repos = getOption("repos"))
pacta_loanbook_update(recursive = FALSE, repos = getOption("repos"))
recursive |
If |
repos |
The repositories to use to check for updates.
Defaults to |
returns NULL
invisibly. The function is called for its side effect
of printing the status of locally installed, relevant packages.
Other utility functions:
pacta_loanbook_conflicts()
,
pacta_loanbook_deps()
,
pacta_loanbook_logo()
,
pacta_loanbook_packages()
,
pacta_loanbook_sitrep()
## Not run: pacta_loanbook_update() ## End(Not run)
## Not run: pacta_loanbook_update() ## End(Not run)
All datasets have at least two columns:
label
: Text label of the colour.
hex
: Hex code of the colour.
palette_colours
palette_colours
An object of class tbl_df
(inherits from tbl
, data.frame
) with 9 rows and 2 columns.
In scenario_colours
, colours are ordered from red to green to be used in
trajectory charts.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
isic_classification
,
iso_codes
,
nace_classification
,
naics_classification
,
psic_classification
,
region_isos
,
scenario_colours
,
sector_classifications
,
sector_colours
,
sic_classification
,
technology_colours
palette_colours scenario_colours sector_colours technology_colours
palette_colours scenario_colours sector_colours technology_colours
Create an emission intensity plot
plot_emission_intensity(data)
plot_emission_intensity(data)
data |
A data frame like the output of |
An object of class "ggplot".
Other plotting functions:
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
# plot with `qplot_emission_intensity()` parameters data <- subset(sda, sector == "cement" & region == "global") %>% prep_emission_intensity(span_5yr = TRUE, convert_label = to_title) plot_emission_intensity(data)
# plot with `qplot_emission_intensity()` parameters data <- subset(sda, sector == "cement" & region == "global") %>% prep_emission_intensity(span_5yr = TRUE, convert_label = to_title) plot_emission_intensity(data)
Create a techmix plot
plot_techmix(data)
plot_techmix(data)
data |
A data frame like the output of |
An object of class "ggplot".
Other plotting functions:
plot_emission_intensity()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
# plot with `qplot_techmix()` parameters data <- subset( market_share, scenario_source == "demo_2020" & sector == "power" & region == "global" & metric %in% c("projected", "corporate_economy", "target_sds") ) %>% prep_techmix( span_5yr = TRUE, convert_label = recode_metric_techmix, convert_tech_label = spell_out_technology ) plot_techmix(data)
# plot with `qplot_techmix()` parameters data <- subset( market_share, scenario_source == "demo_2020" & sector == "power" & region == "global" & metric %in% c("projected", "corporate_economy", "target_sds") ) %>% prep_techmix( span_5yr = TRUE, convert_label = recode_metric_techmix, convert_tech_label = spell_out_technology ) plot_techmix(data)
Create a trajectory plot
plot_trajectory(data, center_y = FALSE, perc_y_scale = FALSE)
plot_trajectory(data, center_y = FALSE, perc_y_scale = FALSE)
data |
A data frame like the outputs of
|
center_y |
Logical. Use |
perc_y_scale |
Logical. |
An object of class "ggplot".
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
# plot with `qplot_trajectory()` parameters data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) %>% prep_trajectory() plot_trajectory( data, center_y = TRUE, perc_y_scale = TRUE )
# plot with `qplot_trajectory()` parameters data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) %>% prep_trajectory() plot_trajectory( data, center_y = TRUE, perc_y_scale = TRUE )
Prepare data for a emission intensity plot
prep_emission_intensity(data, convert_label = identity, span_5yr = FALSE)
prep_emission_intensity(data, convert_label = identity, span_5yr = FALSE)
data |
A data frame. Requirements:
|
convert_label |
A symbol. The unquoted name of a function to apply to y-axis labels. For example:
|
span_5yr |
Logical. Use |
A data-frame ready to be plotted using plot_emission_intensity()
.
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
# `data` must meet documented "Requirements" data <- subset(sda, sector == "cement" & region == "global") prep_emission_intensity(data)
# `data` must meet documented "Requirements" data <- subset(sda, sector == "cement" & region == "global") prep_emission_intensity(data)
Prepare data for plotting technology mix
prep_techmix( data, convert_label = identity, span_5yr = FALSE, convert_tech_label = identity )
prep_techmix( data, convert_label = identity, span_5yr = FALSE, convert_tech_label = identity )
data |
A data frame. Requirements:
|
convert_label |
A symbol. The unquoted name of a function to apply to y-axis labels. For example:
|
span_5yr |
Logical. Use |
convert_tech_label |
A symbol. The unquoted name of a function to apply
to technology legend labels. For example, to convert labels to uppercase
use |
A data-frame ready to be plotted using plot_techmix()
.
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
# `data` must meet documented "Requirements" data <- subset( market_share, scenario_source == "demo_2020" & sector == "power" & region == "global" & metric %in% c("projected", "corporate_economy", "target_sds") ) prep_techmix(data)
# `data` must meet documented "Requirements" data <- subset( market_share, scenario_source == "demo_2020" & sector == "power" & region == "global" & metric %in% c("projected", "corporate_economy", "target_sds") ) prep_techmix(data)
Prepare data for a trajectory plot
prep_trajectory( data, convert_label = identity, span_5yr = FALSE, value_col = "percentage_of_initial_production_by_scope" )
prep_trajectory( data, convert_label = identity, span_5yr = FALSE, value_col = "percentage_of_initial_production_by_scope" )
data |
A data frame. Requirements:
|
convert_label |
A symbol. The unquoted name of a function to apply to y-axis labels. For example:
|
span_5yr |
Logical. Use |
value_col |
Character. Name of the column to be used as a value to be plotted. |
A data-frame ready to be plotted using plot_trajectory()
.
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) prep_trajectory(data)
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) prep_trajectory(data)
score
is 1 and level
per loan is of highest priority
When multiple perfect matches are found per loan (e.g. a match at
direct_loantaker
level and ultimate_parent
level), we must prioritize the
desired match. By default, the highest priority
is the most granular match
(i.e. direct_loantaker
).
prioritize(data, priority = NULL)
prioritize(data, priority = NULL)
data |
A data frame like the validated output of |
priority |
One of:
|
How to validate data
Write the output of match_name()
into a .csv file with:
# Writting to current working directory matched %>% readr::write_csv("matched.csv")
Compare, edit, and save the data manually:
Open matched.csv with any spreadsheet editor (Excel, Google Sheets, etc.).
Compare the columns name
and name_abcd
manually to determine if the match is valid. Other information can be used in conjunction with just the names to ensure the two entities match (sector, internal information on the company structure, etc.)
Edit the data:
If you are happy with the match, set the score
value to 1
.
Otherwise set or leave the score
value to anything other than 1
.
Save the edited file as, say, valid_matches.csv.
Re-read the edited file (validated) with:
# Reading from current working directory valid_matches <- readr::read_csv("valid_matches.csv")
A data frame with a single row per loan, where score
is 1 and
priority level is highest.
This function ignores but preserves existing groups.
Other matching functions:
crucial_lbk()
,
match_name()
,
prioritize_level()
library(dplyr) # styler: off matched <- tribble( ~sector, ~sector_abcd, ~score, ~id_loan, ~level, "coal", "coal", 1, "aa", "ultimate_parent", "coal", "coal", 1, "aa", "direct_loantaker", "coal", "coal", 1, "bb", "intermediate_parent", "coal", "coal", 1, "bb", "ultimate_parent", ) # styler: on prioritize_level(matched) # Using default priority prioritize(matched) # Using the reverse of the default priority prioritize(matched, priority = rev) # Same prioritize(matched, priority = ~ rev(.x)) # Using a custom priority bad_idea <- c("intermediate_parent", "ultimate_parent", "direct_loantaker") prioritize(matched, priority = bad_idea)
library(dplyr) # styler: off matched <- tribble( ~sector, ~sector_abcd, ~score, ~id_loan, ~level, "coal", "coal", 1, "aa", "ultimate_parent", "coal", "coal", 1, "aa", "direct_loantaker", "coal", "coal", 1, "bb", "intermediate_parent", "coal", "coal", 1, "bb", "ultimate_parent", ) # styler: on prioritize_level(matched) # Using default priority prioritize(matched) # Using the reverse of the default priority prioritize(matched, priority = rev) # Same prioritize(matched, priority = ~ rev(.x)) # Using a custom priority bad_idea <- c("intermediate_parent", "ultimate_parent", "direct_loantaker") prioritize(matched, priority = bad_idea)
level
values in default order of priority
Arrange unique level
values in default order of priority
prioritize_level(data)
prioritize_level(data)
data |
A data frame, commonly the output of |
A character vector of the default level priority per loan.
Other matching functions:
crucial_lbk()
,
match_name()
,
prioritize()
matched <- tibble::tibble( level = c( "intermediate_parent_1", "direct_loantaker", "direct_loantaker", "direct_loantaker", "ultimate_parent", "intermediate_parent_2" ) ) prioritize_level(matched)
matched <- tibble::tibble( level = c( "intermediate_parent_1", "direct_loantaker", "direct_loantaker", "direct_loantaker", "ultimate_parent", "intermediate_parent_2" ) ) prioritize_level(matched)
This dataset serves as a translation key between common sector-classification systems and sectors relevant to the 'PACTA' tool (https://www.transitionmonitor.com/).
psic_classification
psic_classification
An object of class tbl_df
(inherits from tbl
, data.frame
) with 1271 rows and 5 columns.
borderline
(logical): Flag indicating if PACTA sector and classification code are a borderline match. The value TRUE indicates that the match is uncertain between the PACTA sector and the classification. The value FALSE indicates that the match is certainly perfect or the classification is certainly out of PACTA's scope.., * code
(character): Formatted PSIC classification code., * description
(character): Original PSIC classification sector name., * sector
(character): Associated PACTA sector., * version
(character): Column identifying which year the classification was published in..
Classification datasets help to standardize sector classification codes from the wild to a relevant subset including 'power', 'oil and gas', 'coal', 'automotive', 'aviation', 'concrete', 'steel', and 'shipping'.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
isic_classification
,
iso_codes
,
nace_classification
,
naics_classification
,
palette_colours
,
region_isos
,
scenario_colours
,
sector_classifications
,
sector_colours
,
sic_classification
,
technology_colours
head(psic_classification)
head(psic_classification)
Compared to plot_emission_intensity()
this function:
is restricted to plotting future as 5 years from the start year,
outputs formatted labels, based on emission metric column,
outputs a title,
outputs formatted axis labels.
qplot_emission_intensity(data)
qplot_emission_intensity(data)
data |
A data frame like the output of |
An object of class "ggplot".
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
# `data` must meet documented "Requirements" data <- subset(sda, sector == "cement" & region == "global") qplot_emission_intensity(data)
# `data` must meet documented "Requirements" data <- subset(sda, sector == "cement" & region == "global") qplot_emission_intensity(data)
Compared to plot_techmix()
this function:
is restricted to plotting future as 5 years from the start year,
outputs pretty bar labels, based on metric column,
outputs pretty legend labels, based on technology column,
outputs a title.
qplot_techmix(data)
qplot_techmix(data)
data |
A data frame like the output of |
An object of class "ggplot".
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & region == "global" & scenario_source == "demo_2020" & metric %in% c("projected", "corporate_economy", "target_sds") ) qplot_techmix(data)
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & region == "global" & scenario_source == "demo_2020" & metric %in% c("projected", "corporate_economy", "target_sds") ) qplot_techmix(data)
Compared to plot_trajectory()
this function:
is restricted to plotting only 5 years from the start year,
outputs pretty legend labels, based on the column holding metrics,
outputs a title,
outputs a subtitle,
outputs informative axis labels in sentence case.
qplot_trajectory(data)
qplot_trajectory(data)
data |
A data frame like the outputs of
|
An object of class "ggplot".
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) qplot_trajectory(data)
# `data` must meet documented "Requirements" data <- subset( market_share, sector == "power" & technology == "renewablescap" & region == "global" & scenario_source == "demo_2020" ) qplot_trajectory(data)
qplot_*()
functionsto_title()
converts labels like qplot_emission_intensity()
.
recode_metric_trajectory()
converts labels like qplot_trajectory()
.
recode_metric_techmix()
converts labels like qplot_techmix()
.
spell_out_technology()
converts technology labels like qplot_techmix()
.
recode_metric_techmix(x)
recode_metric_techmix(x)
x |
A character vector. |
A character vector.
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
to_title(c("a.string", "another_STRING")) metric <- c("projected", "corporate_economy", "target_xyz", "else") recode_metric_trajectory(metric) recode_metric_techmix(metric) spell_out_technology(c("gas", "ice", "coalcap", "hdv"))
to_title(c("a.string", "another_STRING")) metric <- c("projected", "corporate_economy", "target_xyz", "else") recode_metric_trajectory(metric) recode_metric_techmix(metric) spell_out_technology(c("gas", "ice", "coalcap", "hdv"))
qplot_*()
functionsto_title()
converts labels like qplot_emission_intensity()
.
recode_metric_trajectory()
converts labels like qplot_trajectory()
.
recode_metric_techmix()
converts labels like qplot_techmix()
.
spell_out_technology()
converts technology labels like qplot_techmix()
.
recode_metric_trajectory(x)
recode_metric_trajectory(x)
x |
A character vector. |
A character vector.
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
to_title(c("a.string", "another_STRING")) metric <- c("projected", "corporate_economy", "target_xyz", "else") recode_metric_trajectory(metric) recode_metric_techmix(metric) spell_out_technology(c("gas", "ice", "coalcap", "hdv"))
to_title(c("a.string", "another_STRING")) metric <- c("projected", "corporate_economy", "target_xyz", "else") recode_metric_trajectory(metric) recode_metric_techmix(metric) spell_out_technology(c("gas", "ice", "coalcap", "hdv"))
This dataset maps codes representing countries to regions.
For information about the ISO standard for country codes see https://www.iso.org/iso-3166-country-codes.html.
region_isos
region_isos
An object of class tbl_df
(inherits from tbl
, data.frame
) with 9262 rows and 3 columns.
isos
(character): Countries in region, defined by iso code., * region
(character): Benchmark region name., * source
(character): Source publication from which the regions are defined.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
isic_classification
,
iso_codes
,
nace_classification
,
naics_classification
,
palette_colours
,
psic_classification
,
scenario_colours
,
sector_classifications
,
sector_colours
,
sic_classification
,
technology_colours
head(region_isos)
head(region_isos)
This dataset maps codes representing countries to regions. It is similar to but smaller than region_isos.
Demo datasets are synthetic because most financial data is strictly private; they help to demonstrate and test the implementation in R of 'PACTA' (https://www.transitionmonitor.com/).
For information about the ISO standard for country codes see https://www.iso.org/iso-3166-country-codes.html.
region_isos_demo
region_isos_demo
An object of class tbl_df
(inherits from tbl
, data.frame
) with 358 rows and 3 columns.
isos
(character): Countries in region, defined by iso code., * region
(character): Benchmark region name., * source
(character): Source publication from which the regions are defined.
Other demo data:
abcd_demo
,
co2_intensity_scenario_demo
,
loanbook_demo
,
market_share
,
overwrite_demo
,
scenario_demo_2020
,
sda
region_isos_demo
region_isos_demo
A custom discrete colour and fill scales with colours from 2DII palette.
scale_colour_r2dii(colour_labels = NULL, ...)
scale_colour_r2dii(colour_labels = NULL, ...)
colour_labels |
A character vector. Specifies colour labels to use and their
order. Run |
... |
Other parameters passed on to |
An object of class "ScaleDiscrete".
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii() ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii()
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii() ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii()
A custom discrete colour and fill scales with colours from 2DII sector palette.
scale_colour_r2dii_sector(sectors = NULL, ...)
scale_colour_r2dii_sector(sectors = NULL, ...)
sectors |
A character vector. Specifies sector colours to use and their
order. Run |
... |
Other parameters passed on to |
An object of class "ScaleDiscrete".
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii_sector() ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii_sector()
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii_sector() ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii_sector()
A custom discrete colour and fill scales with colours from 2DII technology palette.
scale_colour_r2dii_tech(sector, technologies = NULL, ...)
scale_colour_r2dii_tech(sector, technologies = NULL, ...)
sector |
A string. Sector name specifying a colour palette. Run
|
technologies |
A character vector. Specifies technologies to use as
colours and their order. Run
|
... |
Other parameters passed on to |
An object of class "ScaleDiscrete".
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii_tech("automotive") ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii_tech("automotive")
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii_tech("automotive") ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii_tech("automotive")
A custom discrete colour and fill scales with colours from 2DII palette.
scale_fill_r2dii(colour_labels = NULL, ...)
scale_fill_r2dii(colour_labels = NULL, ...)
colour_labels |
A character vector. Specifies colour labels to use and their
order. Run |
... |
Other parameters passed on to |
An object of class "ScaleDiscrete".
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii() ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii()
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii() ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii()
A custom discrete colour and fill scales with colours from 2DII sector palette.
scale_fill_r2dii_sector(sectors = NULL, ...)
scale_fill_r2dii_sector(sectors = NULL, ...)
sectors |
A character vector. Specifies sector colours to use and their
order. Run |
... |
Other parameters passed on to |
An object of class "ScaleDiscrete".
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii_sector() ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii_sector()
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii_sector() ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii_sector()
A custom discrete colour and fill scales with colours from 2DII technology palette.
scale_fill_r2dii_tech(sector, technologies = NULL, ...)
scale_fill_r2dii_tech(sector, technologies = NULL, ...)
sector |
A string. Sector name specifying a colour palette. Run
|
technologies |
A character vector. Specifies technologies to use as
colours and their order. Run
|
... |
Other parameters passed on to |
An object of class "ScaleDiscrete".
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
spell_out_technology()
,
theme_2dii()
,
to_title()
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii_tech("automotive") ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii_tech("automotive")
library(ggplot2, warn.conflicts = FALSE) ggplot(mpg) + geom_point(aes(displ, hwy, color = class)) + scale_colour_r2dii_tech("automotive") ggplot(mpg) + geom_histogram(aes(cyl, fill = class), position = "dodge", bins = 5) + scale_fill_r2dii_tech("automotive")
All datasets have at least two columns:
label
: Text label of the colour.
hex
: Hex code of the colour.
scenario_colours
scenario_colours
An object of class tbl_df
(inherits from tbl
, data.frame
) with 5 rows and 2 columns.
In scenario_colours
, colours are ordered from red to green to be used in
trajectory charts.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
isic_classification
,
iso_codes
,
nace_classification
,
naics_classification
,
palette_colours
,
psic_classification
,
region_isos
,
sector_classifications
,
sector_colours
,
sic_classification
,
technology_colours
palette_colours scenario_colours sector_colours technology_colours
palette_colours scenario_colours sector_colours technology_colours
Fake climate scenario dataset, prepared for the software PACTA (Paris Agreement Capital Transition Assessment). It imitates climate scenario data (e.g. from the International Energy Agency (IEA)) including the change through time in production across industrial sectors.
Demo datasets are synthetic because most financial data is strictly private; they help to demonstrate and test the implementation in R of 'PACTA' (https://www.transitionmonitor.com/).
scenario_demo_2020
scenario_demo_2020
An object of class tbl_df
(inherits from tbl
, data.frame
) with 1512 rows and 8 columns.
region
(character): The region to which the pathway is relevant., * scenario
(character): The name of the scenario., * scenario_source
(character): The source publication from which the scenario was taken., * sector
(character): The sector to which the scenario prescribes a pathway., * smsp
(double): Sector market share percentage of the pathway calculated in 2020., * technology
(character): The technology within the sector to which the scenario prescribes a pathway., * tmsr
(double): Technology market share ratio of the pathway calculated in 2020., * year
(integer): The year at which the pathway value is prescribed.
Other demo data:
abcd_demo
,
co2_intensity_scenario_demo
,
loanbook_demo
,
market_share
,
overwrite_demo
,
region_isos_demo
,
sda
head(scenario_demo_2020)
head(scenario_demo_2020)
sda
-like datasetDataset imitating the output of r2dii.analysis::target_sda()
.
sda
sda
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 110 rows and 6 columns.
https://github.com/RMI-PACTA/r2dii.plot/issues/55.
Other demo data:
abcd_demo
,
co2_intensity_scenario_demo
,
loanbook_demo
,
market_share
,
overwrite_demo
,
region_isos_demo
,
scenario_demo_2020
sda
sda
This dataset lists all sector classification code standards used by 'PACTA' (https://www.transitionmonitor.com/).
sector_classifications
sector_classifications
An object of class tbl_df
(inherits from tbl
, data.frame
) with 6559 rows and 4 columns.
borderline
(character): Flag indicating if 2dii sector and classification code are a borderline match. The value TRUE indicates that the match is uncertain between the 2dii sector and the classification. The value FALSE indicates that the match is certainly perfect or the classification is certainly out of 2dii's scope.., * code
(character): Formatted code., * code_system
(character): Code system., * sector
(character): Associated 2dii sector.
Classification datasets help to standardize sector classification codes from the wild to a relevant subset including 'power', 'oil and gas', 'coal', 'automotive', 'aviation', 'concrete', 'steel', and 'shipping'.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
isic_classification
,
iso_codes
,
nace_classification
,
naics_classification
,
palette_colours
,
psic_classification
,
region_isos
,
scenario_colours
,
sector_colours
,
sic_classification
,
technology_colours
head(sector_classifications)
head(sector_classifications)
All datasets have at least two columns:
label
: Text label of the colour.
hex
: Hex code of the colour.
sector_colours
sector_colours
An object of class tbl_df
(inherits from tbl
, data.frame
) with 8 rows and 2 columns.
In scenario_colours
, colours are ordered from red to green to be used in
trajectory charts.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
isic_classification
,
iso_codes
,
nace_classification
,
naics_classification
,
palette_colours
,
psic_classification
,
region_isos
,
scenario_colours
,
sector_classifications
,
sic_classification
,
technology_colours
palette_colours scenario_colours sector_colours technology_colours
palette_colours scenario_colours sector_colours technology_colours
This dataset serves as a translation key between common sector-classification systems and sectors relevant to the 'PACTA' tool (https://www.transitionmonitor.com/).
sic_classification
sic_classification
An object of class tbl_df
(inherits from tbl
, data.frame
) with 1005 rows and 5 columns.
borderline
(character): Flag indicating if PACTA sector and classification code are a borderline match. The value TRUE indicates that the match is uncertain between the PACTA sector and the classification. The value FALSE indicates that the match is certainly perfect or the classification is certainly out of PACTA's scope.., * code
(character): Original SIC code., * description
(character): Original SIC description., * sector
(character): Associated PACTA sector., * version
(character): Column identifying to which SIC version the code belongs.
Classification datasets help to standardize sector classification codes from the wild to a relevant subset including 'power', 'oil and gas', 'coal', 'automotive', 'aviation', 'concrete', 'steel', and 'shipping'.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
isic_classification
,
iso_codes
,
nace_classification
,
naics_classification
,
palette_colours
,
psic_classification
,
region_isos
,
scenario_colours
,
sector_classifications
,
sector_colours
,
technology_colours
head(sic_classification)
head(sic_classification)
qplot_*()
functionsto_title()
converts labels like qplot_emission_intensity()
.
recode_metric_trajectory()
converts labels like qplot_trajectory()
.
recode_metric_techmix()
converts labels like qplot_techmix()
.
spell_out_technology()
converts technology labels like qplot_techmix()
.
spell_out_technology(x)
spell_out_technology(x)
x |
A character vector. |
A character vector.
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
theme_2dii()
,
to_title()
to_title(c("a.string", "another_STRING")) metric <- c("projected", "corporate_economy", "target_xyz", "else") recode_metric_trajectory(metric) recode_metric_techmix(metric) spell_out_technology(c("gas", "ice", "coalcap", "hdv"))
to_title(c("a.string", "another_STRING")) metric <- c("projected", "corporate_economy", "target_xyz", "else") recode_metric_trajectory(metric) recode_metric_techmix(metric) spell_out_technology(c("gas", "ice", "coalcap", "hdv"))
This function calculates targets of CO2 emissions per unit production at the portfolio-level, otherwise referred to as "emissions factors". It uses the sectoral-decarbonization approach (SDA) to calculate these targets.
target_sda( data, abcd, co2_intensity_scenario, use_credit_limit = FALSE, by_company = FALSE, region_isos = r2dii.data::region_isos )
target_sda( data, abcd, co2_intensity_scenario, use_credit_limit = FALSE, by_company = FALSE, region_isos = r2dii.data::region_isos )
data |
A dataframe like the output of
|
abcd |
An asset-level data frame like r2dii.data::abcd_demo. |
co2_intensity_scenario |
A scenario data frame like r2dii.data::co2_intensity_scenario_demo. |
use_credit_limit |
Logical vector of length 1. |
by_company |
Logical vector of length 1. |
region_isos |
A data frame like r2dii.data::region_isos (default). |
A tibble including the summarized columns emission_factor_metric
and
emission_factor_value
. If by_company = TRUE
, the output will also have
the column name_abcd
.
This function ignores existing groups and outputs ungrouped data.
Other analysis functions:
target_market_share()
library(r2dii.match) library(r2dii.data) loanbook <- head(loanbook_demo, 150) abcd <- head(abcd_demo, 100) matched <- loanbook %>% match_name(abcd) %>% prioritize() # Calculate targets at portfolio level matched %>% target_sda( abcd = abcd, co2_intensity_scenario = co2_intensity_scenario_demo, region_isos = region_isos_demo ) # Calculate targets at company level matched %>% target_sda( abcd = abcd, co2_intensity_scenario = co2_intensity_scenario_demo, region_isos = region_isos_demo, by_company = TRUE )
library(r2dii.match) library(r2dii.data) loanbook <- head(loanbook_demo, 150) abcd <- head(abcd_demo, 100) matched <- loanbook %>% match_name(abcd) %>% prioritize() # Calculate targets at portfolio level matched %>% target_sda( abcd = abcd, co2_intensity_scenario = co2_intensity_scenario_demo, region_isos = region_isos_demo ) # Calculate targets at company level matched %>% target_sda( abcd = abcd, co2_intensity_scenario = co2_intensity_scenario_demo, region_isos = region_isos_demo, by_company = TRUE )
All datasets have at least two columns:
label
: Text label of the colour.
hex
: Hex code of the colour.
technology_colours
technology_colours
An object of class tbl_df
(inherits from tbl
, data.frame
) with 18 rows and 3 columns.
In scenario_colours
, colours are ordered from red to green to be used in
trajectory charts.
Other datasets:
gics_classification
,
increasing_or_decreasing
,
isic_classification
,
iso_codes
,
nace_classification
,
naics_classification
,
palette_colours
,
psic_classification
,
region_isos
,
scenario_colours
,
sector_classifications
,
sector_colours
,
sic_classification
palette_colours scenario_colours sector_colours technology_colours
palette_colours scenario_colours sector_colours technology_colours
A ggplot theme which can be applied to all graphs to appear according to 2DII plotting aesthetics.
theme_2dii( base_size = 12, base_family = "Helvetica", base_line_size = base_size/22, base_rect_size = base_size/22 )
theme_2dii( base_size = 12, base_family = "Helvetica", base_line_size = base_size/22, base_rect_size = base_size/22 )
base_size |
base font size, given in pts. |
base_family |
base font family |
base_line_size |
base size for line elements |
base_rect_size |
base size for rect elements |
An object of class "theme", "gg".
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
to_title()
library(ggplot2, warn.conflicts = FALSE) ggplot(mtcars) + geom_histogram(aes(mpg), bins = 10) + theme_2dii()
library(ggplot2, warn.conflicts = FALSE) ggplot(mtcars) + geom_histogram(aes(mpg), bins = 10) + theme_2dii()
qplot_*()
functionsto_title()
converts labels like qplot_emission_intensity()
.
recode_metric_trajectory()
converts labels like qplot_trajectory()
.
recode_metric_techmix()
converts labels like qplot_techmix()
.
spell_out_technology()
converts technology labels like qplot_techmix()
.
to_title(x)
to_title(x)
x |
A character vector. |
A character vector.
Other plotting functions:
plot_emission_intensity()
,
plot_techmix()
,
plot_trajectory()
,
prep_emission_intensity()
,
prep_techmix()
,
prep_trajectory()
,
qplot_emission_intensity()
,
qplot_techmix()
,
qplot_trajectory()
,
recode_metric_techmix()
,
recode_metric_trajectory()
,
scale_colour_r2dii()
,
scale_colour_r2dii_sector()
,
scale_colour_r2dii_tech()
,
scale_fill_r2dii()
,
scale_fill_r2dii_sector()
,
scale_fill_r2dii_tech()
,
spell_out_technology()
,
theme_2dii()
to_title(c("a.string", "another_STRING")) metric <- c("projected", "corporate_economy", "target_xyz", "else") recode_metric_trajectory(metric) recode_metric_techmix(metric) spell_out_technology(c("gas", "ice", "coalcap", "hdv"))
to_title(c("a.string", "another_STRING")) metric <- c("projected", "corporate_economy", "target_xyz", "else") recode_metric_trajectory(metric) recode_metric_techmix(metric) spell_out_technology(c("gas", "ice", "coalcap", "hdv"))