── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.0 ✔ tibble 3.2.1
✔ lubridate 1.9.3 ✔ tidyr 1.3.1
✔ 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(readxl)library(sf)
Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
library(leaflet)library(plotly)
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
plot_ly(data = new, x =~year, y =~value, color =~indicator, type ='scatter',mode ="lines") %>%layout(title ="Global Public Climate Finance by Adaption/Mitigation")
plot_ly(data = new, x =~year, y =~value,type ="bar" ,color =~indicator) %>%layout(title ="Global Public Climate Finance by Adaption/Mitigation")
3 Fossil fuel emission - Income level - total climate fund deposited
CO2 <-read_excel("EDGARv8.0_FT2022_GHG_booklet_2023_fossilCO2_only.xlsx", sheet ="fossil_CO2_totals_by_country")%>%select(Country, `2022`)funds <-read_excel("CFU-Website-MASTER-February-2024.xlsx", sheet ="Pledges")combined_data <- funds %>%select(Country, `Country Income Level`, `Deposited (USD million current)`) %>%group_by(Country, `Country Income Level`) %>%filter(row_number() ==1) %>%left_join(CO2) %>%rename(value =`2022`) %>%mutate_at("Country Income Level", ~factor(., levels =c("Not applicable", "Lower middle income", "Upper middle income", "High income"), ordered = T))
Joining with `by = join_by(Country)`
combined_data
# A tibble: 68 × 4
# Groups: Country, Country Income Level [68]
Country `Country Income Level` `Deposited (USD million current)` value
<chr> <ord> <dbl> <dbl>
1 Belgium High income 7.86 90.4
2 Canada High income 19.9 582.
3 Finland High income 6.83 37.3
4 France High income 0.67 NA
5 Korea, Rep. High income 3 NA
6 Netherlands High income 48.6 135.
7 Norway High income 18.8 42.3
8 Sweden High income 10.4 37.9
9 Switzerland High income 11.0 NA
10 United Kingdom High income 203. 341.
# ℹ 58 more rows
plot_ly(data = combined_data, x =~value, y =~`Deposited (USD million current)`, mode ="markers",type ="scatter",marker =list(size =~value/20,opacity =0.4), color =~`Country Income Level`,colors =c("skyblue","green", "red"),hovertemplate =~paste0("Country:", Country, "\n","Total CO2 Fossil Fuel Emission:", round(value), "\n", "Total Climate Fund Deposited (USD million current):", `Deposited (USD million current)`)) %>%layout(title ="climate fund is going to xxxxx",legend =list(title =list(text ="Income Group")),yaxis =list(title ="Total Climate Fund Deposited (USD million current)",type ="log"),xaxis =list(title ="Total CO2 Fossil Fuel Emission", type ="log"))