telerenew <- WDIE %>%
rename(Indicator = "Indicator Code")%>%
rename(Country = "Country Code")%>%
pivot_longer('1990':'2021', names_to = "year") %>%
mutate(year = as.numeric(year)) %>%
filter(!is.na(value)) %>%
filter(Indicator %in% c("EG.ELC.RNWX.ZS","EG.ELC.COAL.ZS","EG.ELC.HYRO.ZS","EG.ELC.NGAS.ZS","EG.ELC.NUCL.ZS","EG.ELC.PETR.ZS"))
telerenew$Indicator[telerenew$Indicator == "EG.ELC.COAL.ZS"] <- "elecoal"
telerenew$Indicator[telerenew$Indicator == "EG.ELC.HYRO.ZS"] <- "elehydro"
telerenew$Indicator[telerenew$Indicator == "EG.ELC.NGAS.ZS"] <- "elengas"
telerenew$Indicator[telerenew$Indicator == "EG.ELC.NUCL.ZS"] <- "elenuc"
telerenew$Indicator[telerenew$Indicator == "EG.ELC.PETR.ZS"] <- "eleoil"
telerenew$Indicator[telerenew$Indicator == "EG.ELC.RNWX.ZS"] <- "elerenew"
Global Electricity Energy Sources Trend
telerenew4<- telerenew %>%
filter(Indicator %in% c("elecoal","elehydro","elengas","elenuc","eleoil", "elerenew"))%>%
filter (Country %in% c("HIC", "LMC","MIC", "UMC", "LIC"))%>%
group_by(year, Indicator)%>%
summarize(sum = sum(value))
ggplot(telerenew4, aes (x = year, y = sum, group = Indicator))+
geom_line(aes(colour = Indicator))+
geom_point(aes(x = year, y = sum, colour = Indicator))+
labs(
title = "General Trend: Electricity Produced with Six Energy Sources",
subtitle = "Cross Energy Sources (Year 1990 - 2015)",
caption = "Data from World Bank Dataset.",
tag = "Figure 2",
x = "Year",
y = "% of total electricity production",
colour = "Energy Sources"
)+
theme_gray()

Cross-Regional Comparison Based on Income Groupings
Gloabl Level Analysis
telerenew5<- telerenew %>%
filter(Indicator == "elerenew")%>%
filter (Country %in% c("HIC", "LMC","MIC", "UMC", "LIC"))%>%
filter (year < "2015")%>%
group_by(year, Country)%>%
summarize(sum = sum(value))
p1<- ggplot(telerenew5, aes (x = year, y = sum, group = Country))+
geom_line(aes(colour = Country))+
geom_point(aes(x = year, y = sum, colour = Country))+
labs(
title = "Global Trend: Electricity Produced by Renewable Energy",
subtitle = "Cross Income Groups (Year 1990-2014)",
caption = "Data from World Bank Dataset.",
tag = "Figure 3",
x = "Year",
y = "% of the energy source",
colour = "Country"
)+
theme_gray()
telerenew5<- telerenew %>%
filter(Indicator == "elecoal")%>%
filter (Country %in% c("HIC", "LMC","MIC", "UMC", "LIC"))%>%
filter (year < "2015")%>%
group_by(year, Country)%>%
summarize(sum = sum(value))
p2 <- ggplot(telerenew5, aes (x = year, y = sum, group = Country))+
geom_line(aes(colour = Country))+
geom_point(aes(x = year, y = sum, colour = Country))+
labs(
title = "Global Trend: Electricity Produced by Coal",
subtitle = "Cross Income Groups (Year 1990-2014)",
caption = "Data from World Bank Dataset.",
tag = "Figure 4",
x = "Year",
y = "% of the energy source",
colour = "Country"
)+
theme_gray()
grid.arrange(p1, p2, nrow = 2)

Inter-Regional Analysis
plot2<- renewreg %>%
filter(date >= 2015L & date <= 2015L) %>%
ggplot() +
aes(x = country, y = EG.ELC.RNWX.KH/1000000000) +
geom_bar(stat="identity", width=.5, fill="darkgreen")+
labs(
x = "Regions",
y = "Electricity Production by Renewable Energy in Billion kwh",
tag = "Figure 5",
subtitle = "Electricity Production by Renewable Energy",
caption = "By Region (2015)"
) +
theme_minimal()+
theme(axis.text.x = element_text(angle=45, hjust=1))+
scale_x_discrete(labels=c("East Asia\n& Pacific", "Europe \n& Central Asia", "Latin America \n& Caribbean", "Middle East \n& North Africa", "North America", "South Asia", "Sub-Saharan Africa"))
plot2

Country Level Analysis within East Asia & Pacific Region
plota<-ggplot(reneweaphi, aes(x = date, y = EG.ELC.RNWX.KH/1000000000, color = country, shape = country, group = country)) +
geom_point() +
geom_line() +
labs(title = "Electricity Produced by Renewable Energy: High Income Economies") +
labs(subtitle = "(2000-2015)") +
xlab("Year" ) +
ylab("Electricity production from renewable sources in billion (kWh)") +
labs (tag = "Figure 6")+
scale_x_continuous(breaks = seq(2000,2015,5))+
theme_grey() +
theme(panel.grid.minor.x = element_blank())
plota

plotc<- ggplot(reneweapeumi, aes(x = date, y = EG.ELC.RNWX.KH/1000000000, color = country, shape = country, group = country)) +
geom_point() +
geom_line() +
labs(title = "Electricity Produced by Renewable Energy: Upper Middle Income Economies") +
labs(subtitle = "(2000-2015)") +
xlab("Year") +
ylab("Electricity production from renewable sources in billion (kWh)") +
labs (tag = "Figure 7")+
scale_x_continuous(breaks = seq(2000,2015,5))+
theme_grey() +
theme(panel.grid.minor.x = element_blank())
plotc

plotb<- ggplot(reneweaplmirev, aes(x = date, y = EG.ELC.RNWX.KH/1000000000, color = country, shape = country, group = country)) +
geom_point() +
geom_line() +
labs(title = "Electricity Produced by Renewable Energy: Lower Middle Income Economies") +
labs(subtitle = "(2000-2015)") +
xlab("Year") +
ylab("Electricity production from renewable sources in billion (kWh)") +
labs (tag = "Figure 8")+
scale_x_continuous(breaks = seq(2000,2015,5))+
theme_grey() +
theme(panel.grid.minor.x = element_blank())
plotb

Conclusion and Future Outlook: World Map
# create a vector of the desired indicator series
indicators <- c(elecoal, elehydro, elengas, elenuc, eleoil,
elerenew)
countries <- WDI(country="all", indicator = indicators,
start = 1990, end = 2015, extra = TRUE)
# convert geocodes from factors into numerics
countries$lng <- as.numeric(as.character(countries$longitude))
countries$lat <- as.numeric(as.character(countries$latitude))
# Remove groupings, which have no geocodes
countries <- countries %>%
filter(!is.na(lng))
# filter to 2015 and select relevant variables
wdi98 <- countries %>% filter(year == 2015)%>%
select(country,year, elerenew, income, lat, lng)%>%
mutate(elerenew2 = EG.ELC.RNWX.KH/5000000000)
# Create a color palette with bins.
inccols = colorFactor( palette= c( "#b2df8a","#33a02c", "#a6cee3", "#1f78b4"),
levels = c("High income", "Upper middle income",
"Lower middle income", "Low income"))
#order income levels
wdi98$income <- ordered(wdi98$income, levels = c("High income", "Upper middle income", "Lower middle income", "Low income"))
#create leaflet map for 1998
w98 <- leaflet(data = wdi98) %>%
addTiles() %>% setView(lng = 10, lat =0, zoom = 1.5) %>%
addCircleMarkers(~lng, ~lat,popup = ~as.character(country),
color = ~ inccols(income),
radius = ~elerenew2, stroke = FALSE, fillOpacity = .9)%>%
addLegend(pal = inccols, values = ~income,opacity=0.9,
title = "Income Category", position = "bottomleft" ) %>%
addControl("Income and Population in 2015", position = "bottomright");w98
- Through which type of energy is electricity made from in each
country/ in each region.
- Which country does best in using renewable sources to produce
electricity
- Which country does the worst in using renewable energy sources to
produce electricity?
- What is the level of GHG emission & CO2 emission in that
country?
- What is the CO2 emission from electricity and heat production
- (What is the level of PM2.5 comparing the worst and best
country)
- What is their renewable electricity output?
- Run cross sectional multiple regression: Y is level of electricity
consumption across countries. X1 is number covid 19 cases. Control
variables include: population density, rural vs urban ratio, #
vaccinations…
- Include an interaction term of the ICT electricity use because
research has found that ICT sector development is positively correlated
to a electricity usage. Or include a qualitative analysis of how
shifting towards working from home expedited the digitization process
and the ICT sectors.