Skip to content

Commit

Permalink
add HydroCap in Renewables Energy Exposure (#347)
Browse files Browse the repository at this point in the history
* add HydroCap in Renewables

* Update data prep and plotting

* Update sys data

* Update toy data

* Update scorecard not to overlap

* Update tests

---------

Co-authored-by: Monika Furdyna <[email protected]>
  • Loading branch information
Antoine-Lalechere and MonikaFu authored Jul 10, 2024
1 parent 0db5c8a commit 9df54f6
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 17 deletions.
15 changes: 13 additions & 2 deletions R/plot_exposures_scorecard.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ plot_exposures_scorecard <- function(data) {
hjust = -0.2,
size = 4
) +
scale_x_discrete(labels = r2dii.plot::to_title) +
scale_x_discrete(labels = as_labeller(exposures_scorecard_labeller)) +
scale_y_continuous(expand = expansion(mult = c(0, .8)), labels = scales::percent) +
scale_fill_manual(values = fill_colours_exposures_scorecard) +
coord_flip() +
Expand All @@ -61,8 +61,19 @@ check_data_exposures_scorecard <- function(data, env) {
abort_if_invalid_values(
data,
"sector_or_tech",
c("coal", "other_fossil_fuels", "fossil_power", "renewables_power")
c("coal", "other_fossil_fuels", "fossil_power", "renewables_power", "renewables_and_hydro_power")
)
stopifnot(is.numeric(data$exposure_perc_aum))
stopifnot((data$exposure_perc_aum <= 1) & (data$exposure_perc_aum >= 0))
}

exposures_scorecard_labeller <- function(label) {
if (label == "renewables_and_hydro_power") {
out <- "Renewables and\nHydro Power"
} else if (label == "other_fossil_fuels") {
out <- "Other\nFossil Fuels"
} else {
out <- r2dii.plot::to_title(label)
}
out
}
4 changes: 2 additions & 2 deletions R/prep_exposures_scorecard.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ wrangle_data_exposures_scorecard <- function(data) {
.data$ald_sector == "oil and gas" ~ "other_fossil_fuels",
.data$ald_sector == "oil_and_gas" ~ "other_fossil_fuels",
.data$technology %in% c("coalcap", "gascap", "oilcap") ~ "fossil_power",
.data$technology == "renewablescap" ~ "renewables_power",
.data$technology %in% c("renewablescap", "hydrocap") ~ "renewables_and_hydro_power",
TRUE ~ NA_character_
)
) %>%
Expand All @@ -82,7 +82,7 @@ wrangle_data_exposures_scorecard <- function(data) {
mutate(
sector_or_tech = factor(
.data$sector_or_tech,
levels = rev(c("coal", "other_fossil_fuels", "fossil_power", "renewables_power"))
levels = rev(c("coal", "other_fossil_fuels", "fossil_power", "renewables_and_hydro_power"))
)
)
}
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
1 change: 1 addition & 0 deletions data-raw/plots_specs.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ fill_colours_techmix <- c("green" = "#7bc17e", "brown" = "#986B41")

fill_colours_exposures_scorecard <- c(
"renewables_power" = "#7BC17E",
"renewables_and_hydro_power" = "#7BC17E",
"other_fossil_fuels" = "#181716",
"coal" = "#4e3b37",
"fossil_power" = "#977447"
Expand Down
20 changes: 10 additions & 10 deletions data-raw/toy_data_exposures_scorecard.R
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# styler: off
toy_data_exposures_scorecard <- tibble::tribble(
~asset_class, ~sector_or_tech, ~exposure_perc_aum,
"equity", "coal", 0.01,
"equity", "other_fossil_fuels", 0.02,
"equity", "fossil_power", 0.15,
"equity", "renewables_power", 0.12,
"bonds", "coal", 0.03,
"bonds", "other_fossil_fuels", 0.01,
"bonds", "fossil_power", 0.1,
"bonds", "renewables_power", 0.2
~asset_class, ~sector_or_tech, ~exposure_perc_aum,
"equity", "coal", 0.01,
"equity", "other_fossil_fuels", 0.02,
"equity", "fossil_power", 0.15,
"equity", "renewables_and_hydro_power", 0.12,
"bonds", "coal", 0.03,
"bonds", "other_fossil_fuels", 0.01,
"bonds", "fossil_power", 0.1,
"bonds", "renewables_and_hydro_power", 0.2
)
# styler: on

toy_data_exposures_scorecard <- toy_data_exposures_scorecard %>%
mutate(
sector_or_tech = factor(
sector_or_tech,
levels = rev(c("coal", "other_fossil_fuels", "fossil_power", "renewables_power"))
levels = rev(c("coal", "other_fossil_fuels", "fossil_power", "renewables_and_hydro_power"))
)
)

Expand Down
Binary file modified data/toy_data_exposures_scorecard.rda
Binary file not shown.
5 changes: 3 additions & 2 deletions inst/extdata/PA2024CH_en_exec_summary/scorecard.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ Benchmark:
%TODO: make sure that these are still the indices we use
\begin{center}
\begin{tabular}{ p{0.5\linewidth} p{0.5\linewidth} }
\begin{tabular}{ p{0.46\linewidth} p{0.46\linewidth} }
\hline
Listed Equity & Corporate Bonds \\
\hline
iShares MSCI World ETF & iShares Global Corp Bond UCITS ETF \\
iShares MSCI World ETF & iShares Global Corp Bond \\
& UCITS ETF \\
\hline
\end{tabular}
\end{center}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/plot_exposures_scorecard.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# with wrong values of `sector_or_tech` errors gracefully

Each value of `"sector_or_tech"` must be one of these:
coal, other_fossil_fuels, fossil_power, renewables_power.
coal, other_fossil_fuels, fossil_power, renewables_power, renewables_and_hydro_power.
x You passed: bad.

# with non-numeric values of `exposure_perc_aum` errors gracefully
Expand Down

0 comments on commit 9df54f6

Please sign in to comment.