Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.
Running Code
When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.3.2
Warning: package 'ggplot2' was built under R version 4.3.2
Warning: package 'dplyr' was built under R version 4.3.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.3 ✔ readr 2.1.4
✔ forcats 1.0.0 ✔ stringr 1.5.0
✔ ggplot2 3.4.4 ✔ tibble 3.2.1
✔ lubridate 1.9.2 ✔ tidyr 1.3.0
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(janitor)
Attaching package: 'janitor'
The following objects are masked from 'package:stats':
chisq.test, fisher.test
library(countrycode)
Warning: package 'countrycode' was built under R version 4.3.2
Rows: 355 Columns: 42
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (12): Country, ISO2, ISO3, Indicator, Unit, Source, CTS_Code, CTS_Name, ...
dbl (30): ObjectId, F1985, F1986, F1987, F1990, F1991, F1992, F1993, F1994, ...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
green_debt
# A tibble: 355 × 42
ObjectId Country ISO2 ISO3 Indicator Unit Source CTS_Code CTS_Name
<dbl> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
1 1 Argentina AR ARG Green Bo… Bill… Refin… ECFFI Green B…
2 2 Australia AU AUS Green Bo… Bill… Refin… ECFFI Green B…
3 3 Austria AT AUT Green Bo… Bill… Refin… ECFFI Green B…
4 4 Austria AT AUT Sovereig… Bill… Refin… ECFF Green B…
5 5 Bangladesh BD BGD Green Bo… Bill… Refin… ECFFI Green B…
6 6 Belarus, Rep. … BY BLR Green Bo… Bill… Refin… ECFFI Green B…
7 7 Belarus, Rep. … BY BLR Sovereig… Bill… Refin… ECFF Green B…
8 8 Belgium BE BEL Green Bo… Bill… Refin… ECFFI Green B…
9 9 Belgium BE BEL Sovereig… Bill… Refin… ECFF Green B…
10 10 Bermuda BM BMU Green Bo… Bill… Refin… ECFFI Green B…
# ℹ 345 more rows
# ℹ 33 more variables: CTS_Full_Descriptor <chr>, Type_of_Issuer <chr>,
# Use_of_Proceed <chr>, Principal_Currency <chr>, F1985 <dbl>, F1986 <dbl>,
# F1987 <dbl>, F1990 <dbl>, F1991 <dbl>, F1992 <dbl>, F1993 <dbl>,
# F1994 <dbl>, F1999 <dbl>, F2000 <dbl>, F2002 <dbl>, F2003 <dbl>,
# F2004 <dbl>, F2007 <dbl>, F2008 <dbl>, F2009 <dbl>, F2010 <dbl>,
# F2011 <dbl>, F2012 <dbl>, F2013 <dbl>, F2014 <dbl>, F2015 <dbl>, …
indicators_we_want <-c("Green Bond Issuances by Country", "Sovereign Green Bond Issuances")green_debt_subset <- green_debt %>%clean_names() %>%filter(indicator %in% indicators_we_want) %>%select(country, iso3, indicator, matches("f\\d{4}"))green_debt_subset
# A tibble: 107 × 32
country iso3 indicator f1985 f1986 f1987 f1990 f1991 f1992 f1993 f1994 f1999
<chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Argent… ARG Green Bo… NA NA NA NA NA NA NA NA NA
2 Austra… AUS Green Bo… NA NA NA NA NA NA NA NA NA
3 Austria AUT Green Bo… NA NA NA NA NA NA NA NA NA
4 Austria AUT Sovereig… NA NA NA NA NA NA NA NA NA
5 Bangla… BGD Green Bo… NA NA NA NA NA NA NA NA NA
6 Belaru… BLR Green Bo… NA NA NA NA NA NA NA NA NA
7 Belaru… BLR Sovereig… NA NA NA NA NA NA NA NA NA
8 Belgium BEL Green Bo… NA NA NA NA NA NA NA NA NA
9 Belgium BEL Sovereig… NA NA NA NA NA NA NA NA NA
10 Bermuda BMU Green Bo… NA NA NA NA NA NA NA NA NA
# ℹ 97 more rows
# ℹ 20 more variables: f2000 <dbl>, f2002 <dbl>, f2003 <dbl>, f2004 <dbl>,
# f2007 <dbl>, f2008 <dbl>, f2009 <dbl>, f2010 <dbl>, f2011 <dbl>,
# f2012 <dbl>, f2013 <dbl>, f2014 <dbl>, f2015 <dbl>, f2016 <dbl>,
# f2017 <dbl>, f2018 <dbl>, f2019 <dbl>, f2020 <dbl>, f2021 <dbl>,
# f2022 <dbl>
# A tibble: 3,103 × 5
country iso3 indicator name value
<chr> <chr> <chr> <chr> <dbl>
1 Argentina ARG Green Bond Issuances by Country f1985 NA
2 Argentina ARG Green Bond Issuances by Country f1986 NA
3 Argentina ARG Green Bond Issuances by Country f1987 NA
4 Argentina ARG Green Bond Issuances by Country f1990 NA
5 Argentina ARG Green Bond Issuances by Country f1991 NA
6 Argentina ARG Green Bond Issuances by Country f1992 NA
7 Argentina ARG Green Bond Issuances by Country f1993 NA
8 Argentina ARG Green Bond Issuances by Country f1994 NA
9 Argentina ARG Green Bond Issuances by Country f1999 NA
10 Argentina ARG Green Bond Issuances by Country f2000 NA
# ℹ 3,093 more rows
# A tibble: 465 × 5
country iso3 indicator year issuance_bn_usd
<chr> <chr> <chr> <dbl> <dbl>
1 Argentina ARG Green Bond Issuances by Country 2017 0.974
2 Argentina ARG Green Bond Issuances by Country 2020 0.0500
3 Argentina ARG Green Bond Issuances by Country 2021 0.916
4 Argentina ARG Green Bond Issuances by Country 2022 0.207
5 Australia AUS Green Bond Issuances by Country 2014 0.526
6 Australia AUS Green Bond Issuances by Country 2015 0.413
7 Australia AUS Green Bond Issuances by Country 2016 0.531
8 Australia AUS Green Bond Issuances by Country 2017 2.53
9 Australia AUS Green Bond Issuances by Country 2018 2.22
10 Australia AUS Green Bond Issuances by Country 2019 1.98
# ℹ 455 more rows
# A tibble: 465 × 5
country indicator year issuance_bn_usd cumulative_bn_usd
<chr> <chr> <dbl> <dbl> <dbl>
1 Argentina Green Bond Issuances by Co… 2017 0.974 0.974
2 Argentina Green Bond Issuances by Co… 2020 0.0500 1.02
3 Argentina Green Bond Issuances by Co… 2021 0.916 1.94
4 Argentina Green Bond Issuances by Co… 2022 0.207 2.15
5 Australia Green Bond Issuances by Co… 2014 0.526 0.526
6 Australia Green Bond Issuances by Co… 2015 0.413 0.938
7 Australia Green Bond Issuances by Co… 2016 0.531 1.47
8 Australia Green Bond Issuances by Co… 2017 2.53 4.00
9 Australia Green Bond Issuances by Co… 2018 2.22 6.22
10 Australia Green Bond Issuances by Co… 2019 1.98 8.21
# ℹ 455 more rows
biggest_green_bond_issuers <- green_bonds_tidy_cumulative %>%filter(indicator =="Green Bond Issuances by Country") %>%group_by(country) %>%slice_max(order_by = year) %>%arrange(cumulative_bn_usd %>%desc()) %>%select(country, cumulative_bn_usd) %>%ungroup()biggest_green_bond_issuers
# A tibble: 79 × 2
country cumulative_bn_usd
<chr> <dbl>
1 China, P.R.: Mainland 325.
2 Germany 253.
3 France 213.
4 United States 172.
5 Netherlands, The 155.
6 United Kingdom 84.0
7 Sweden 76.6
8 Spain 65.7
9 Japan 61.8
10 Italy 59.9
# ℹ 69 more rows
top_10_chart <- biggest_green_bond_issuers %>%slice_max(order_by = cumulative_bn_usd, n =10) %>%ggplot(aes(x = cumulative_bn_usd, y =fct_reorder(.f = country, .x = cumulative_bn_usd))) +geom_col(fill ="forestgreen")top_10_chart
top_10_chart +theme_minimal() +scale_x_continuous(labels = scales::label_dollar(suffix ="bn"), expand =c(0,0)) +labs(title ="Top 10 Green Bond Issuers", subtitle ="The Dutch sure do issue a whole lot of green bonds per capita",x ="Cumulative Issuance (USD)",y ="",caption ="Data: IMF Climate Change Dashboard | Insight: Me!" )
# A tibble: 420 × 5
country iso3 year Green Bond Issuances by Countr…¹ Sovereign Green Bond…²
<chr> <chr> <dbl> <dbl> <dbl>
1 Argentina ARG 2017 0.974 NA
2 Argentina ARG 2020 0.0500 NA
3 Argentina ARG 2021 0.916 NA
4 Argentina ARG 2022 0.207 NA
5 Australia AUS 2014 0.526 NA
6 Australia AUS 2015 0.413 NA
7 Australia AUS 2016 0.531 NA
8 Australia AUS 2017 2.53 NA
9 Australia AUS 2018 2.22 NA
10 Australia AUS 2019 1.98 NA
# ℹ 410 more rows
# ℹ abbreviated names: ¹`Green Bond Issuances by Country`,
# ²`Sovereign Green Bond Issuances`
# A tibble: 1,260 × 4
country year name value
<chr> <dbl> <chr> <dbl>
1 Argentina 2017 green_bond_issuances_by_country 0.974
2 Argentina 2017 sovereign_green_bond_issuances 0
3 Argentina 2017 corporate_green_bond_issuances 0.974
4 Argentina 2020 green_bond_issuances_by_country 0.0500
5 Argentina 2020 sovereign_green_bond_issuances 0
6 Argentina 2020 corporate_green_bond_issuances 0.0500
7 Argentina 2021 green_bond_issuances_by_country 0.916
8 Argentina 2021 sovereign_green_bond_issuances 0
9 Argentina 2021 corporate_green_bond_issuances 0.916
10 Argentina 2022 green_bond_issuances_by_country 0.207
# ℹ 1,250 more rows
# A tibble: 1,260 × 4
country year indicator issuance_bn_usd
<chr> <dbl> <chr> <dbl>
1 Argentina 2017 Green Bond Issuances By Country 0.974
2 Argentina 2017 Sovereign Green Bond Issuances 0
3 Argentina 2017 Corporate Green Bond Issuances 0.974
4 Argentina 2020 Green Bond Issuances By Country 0.0500
5 Argentina 2020 Sovereign Green Bond Issuances 0
6 Argentina 2020 Corporate Green Bond Issuances 0.0500
7 Argentina 2021 Green Bond Issuances By Country 0.916
8 Argentina 2021 Sovereign Green Bond Issuances 0
9 Argentina 2021 Corporate Green Bond Issuances 0.916
10 Argentina 2022 Green Bond Issuances By Country 0.207
# ℹ 1,250 more rows
# A tibble: 48 × 4
year indicator germany china_p_r_mainland
<dbl> <chr> <dbl> <dbl>
1 1991 Green Bond Issuances By Country 0.0292 0
2 1991 Sovereign Green Bond Issuances 0 0
3 1991 Corporate Green Bond Issuances 0.0292 0
4 1992 Green Bond Issuances By Country 0.0350 0
5 1992 Sovereign Green Bond Issuances 0 0
6 1992 Corporate Green Bond Issuances 0.0350 0
7 1993 Green Bond Issuances By Country 0.0175 0
8 1993 Sovereign Green Bond Issuances 0 0
9 1993 Corporate Green Bond Issuances 0.0175 0
10 2000 Green Bond Issuances By Country 0.0272 0
# ℹ 38 more rows
# A tibble: 48 × 8
year indicator germany china_p_r_mainland germany_x_than_china
<dbl> <chr> <dbl> <dbl> <dbl>
1 1991 Green Bond Issuances B… 0.0292 0 Inf
2 1991 Sovereign Green Bond I… 0 0 NaN
3 1991 Corporate Green Bond I… 0.0292 0 Inf
4 1992 Green Bond Issuances B… 0.0350 0 Inf
5 1992 Sovereign Green Bond I… 0 0 NaN
6 1992 Corporate Green Bond I… 0.0350 0 Inf
7 1993 Green Bond Issuances B… 0.0175 0 Inf
8 1993 Sovereign Green Bond I… 0 0 NaN
9 1993 Corporate Green Bond I… 0.0175 0 Inf
10 2000 Green Bond Issuances B… 0.0272 0 Inf
# ℹ 38 more rows
# ℹ 3 more variables: china_x_than_germany <dbl>,
# germany_pct_more_than_china <dbl>, china_pct_more_than_germany <dbl>
factoid_2014 <- china_vs_germany_green_bonds_repeatable_factoids |>filter(year ==2014) |>filter(indicator =="Green Bond Issuances By Country") |>pull(germany_x_than_china) |>round()factoid_2022 <- china_vs_germany_green_bonds_repeatable_factoids |>filter(year ==2022) |>filter(indicator =="Green Bond Issuances By Country") |>pull(china_pct_more_than_germany) |>round()factoid_2022
Warning: Returning more (or less) than 1 row per `summarise()` group was deprecated in
dplyr 1.1.0.
ℹ Please use `reframe()` instead.
ℹ When switching from `summarise()` to `reframe()`, remember that `reframe()`
always returns an ungrouped data frame and adjust accordingly.
`summarise()` has grouped output by 'regional'. You can override using the
`.groups` argument.
region_cumulative
# A tibble: 465 × 2
# Groups: regional [7]
regional cumulative_bn_usd
<chr> <dbl>
1 East Asia & Pacific 0.526
2 East Asia & Pacific 0.938
3 East Asia & Pacific 1.47
4 East Asia & Pacific 4.00
5 East Asia & Pacific 6.22
6 East Asia & Pacific 8.21
7 East Asia & Pacific 11.1
8 East Asia & Pacific 15.8
9 East Asia & Pacific 20.1
10 East Asia & Pacific 20.4
# ℹ 455 more rows
ggplot(region_cumulative, aes(x = regional, y = cumulative_bn_usd, color = regional)) +geom_point() +labs(title ="Cumulative Green Debt Issuances in USD Billions per Region", x ="Region", y ="Cumulative Bn USD")
ggplot(green_debt_working_1, aes(x =fct_reorder(.f = type_of_issuer, .x = cumulative_bn_usd), y = cumulative_bn_usd, fill = type_of_issuer)) +geom_col() +labs(title ="Cumulative Amount of Issued Funds per Type of Issuer", x ="Type of Issuer", y ="Billions of Dollars in Funds Issued")
# A tibble: 10 × 5
use_of_proceed country year issuance_bn_usd cumulative_bn_usd
<chr> <chr> <chr> <dbl> <dbl>
1 Clean Transport World f2022 833. 1002.
2 Energy Efficiency World f2022 480. 1966.
3 Climate Change Adaptation World f2022 277. 1279.
4 Eligible Green Projects World f2022 204. 1485.
5 Green Construction/Buildings World f2022 127. 2111.
6 Renewable Energy Projects World f2022 108. 2252.
7 Aquatic Biodiversity Conserv… World f2022 75.7 123.
8 Circular Economy Adapted/Eco… World f2022 33.6 168.
9 Alternative Energy World f2022 25.7 46.9
10 Sustainable Water or Wastewa… World f2022 17.7 2277.
ggplot(green_debt_working_A, aes(x =fct_reorder(.f = use_of_proceed, .x = issuance_bn_usd), y = issuance_bn_usd, color = use_of_proceed)) +geom_point() +labs(title ="Amount of Issued Funds per Use of Proceeds", x ="Top 10 Largest Uses of Proceeds", y ="Billions of Dollars")
# A tibble: 10 × 5
principal_currency country year issuance_bn_usd cumulative_bn_usd
<chr> <chr> <chr> <dbl> <dbl>
1 Euro World f2022 976. 1483.
2 US Dollar World f2022 580. 2285.
3 Chinese Yuan World f2022 325. 485.
4 Swedish Krona World f2022 73.3 1672.
5 British Pound World f2022 73.2 106.
6 Canadian Dollar World f2022 53.1 160.
7 Japanese Yen World f2022 33.8 1534.
8 Australian Dollar World f2022 27.8 27.9
9 Swiss Franc World f2022 22.4 1695.
10 Danish Krone World f2022 20.3 507.
ggplot(green_debt_working_B, aes(x =fct_reorder(.f = principal_currency, .x = issuance_bn_usd), y = issuance_bn_usd, color = issuance_bn_usd)) +geom_point() +labs(title ="Amount of Issued Funds per Currency", x ="Top 10 Most Commonly Used Currencies in Green Debt Issuance", y ="Billions of Dollars in Funds Issued")