Final Report

Quarto

library(ggplot2)
library(ggthemes)
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.4
✔ forcats   1.0.0     ✔ stringr   1.5.0
✔ lubridate 1.9.2     ✔ tibble    3.2.1
✔ purrr     1.0.2     ✔ tidyr     1.3.0
── 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(dplyr)
library(pkgdown)
library(esquisse)
library(readxl)

Fossil_fuel_consumption_subsidies_2010_2022 <- read_excel("/Users/sherri/downloads/Fossil fuel consumption subsidies, 2010-2022.xlsx")
library(dplyr)

# Vector with the names of the countries of interest
countries_of_interest <- c("Cambodia", "China","Fiji", "Guam", "Hong Kong SAR, China", "Indonesia", "Kiribati", "Korea", "Laos", "Malaysia", "Marshall Islands","Mongolia", "Myanmar", "NEW CALEDONIA","Philippines", "Samoa", "Singapore", "Solomon Islands", "Thailand","Tonga", "Taipei","Tuvalu", "Vanuatu", "Vietnam")

# Filter out the APAC countries
filtered_data <- Fossil_fuel_consumption_subsidies_2010_2022 %>%
  filter(Country %in% countries_of_interest)
library(dplyr)
library(tidyr)
data_long <- filtered_data %>% 
  gather(key = "Year", value = "Value", -Country, -Product)

summary_data <- data_long %>% 
  group_by(Country, Product) %>% 
  summarise(Total = sum(Value, na.rm = TRUE))
`summarise()` has grouped output by 'Country'. You can override using the
`.groups` argument.
mean_by_year <- data_long %>% 
  filter(Product == "Oil") %>% 
  group_by(Year) %>% 
  summarise(Mean = mean(Value, na.rm = TRUE))

ggplot(mean_by_year, aes(x = Year, y = Mean)) + 
  geom_line(group=1) +  
  geom_point() + 
  theme_minimal() + 
  labs(title = "Mean Values for Oil Subsideis from 2010-2022", x = "Year", y = "Mean") 

#What happened during 2015-2016?

mean_by_year_2 <- data_long %>% 
  filter(Product == "Electricity") %>% 
  group_by(Year) %>% 
  summarise(Mean = mean(Value, na.rm = TRUE))

ggplot(mean_by_year_2, aes(x = Year, y = Mean)) + 
  geom_line(group=1) +  
  geom_point() + 
  theme_minimal() + 
  labs(title = "Mean Values for Electricity Subsideis from 2010-2022", x = "Year", y = "Mean") 

mean_by_year_3 <- data_long %>% 
  filter(Product == "Gas") %>% 
  group_by(Year) %>% 
  summarise(Mean = mean(Value, na.rm = TRUE))

mean_by_year_4 <- data_long %>% 
  filter(Product == "Coal") %>% 
  group_by(Year) %>% 
  summarise(Mean = mean(Value, na.rm = TRUE))
ggplot(data_long, aes(x = Product, y = Value, fill = Product)) +
  geom_bar(stat = "identity") +  
  theme_minimal() +
  labs(title = "Total Energy Subsidies Values", x = "Product", y = "Total Value") +
  scale_fill_brewer(palette = "Set1") 

ggplot(data_long %>% filter(Country == "China"), aes(x = Product, y = Value, fill = Product)) +
  geom_bar(stat = "identity") +  
  theme_minimal() +
  labs(title = "Total Energy Subsidies Values for China", x = "Product", y = "Total Value") +
  scale_fill_brewer(palette = "Set2")