1 Article

Article Link

My article is from Our World in Data, and it discusses how the world faces two energy problems: most of our energy production still produces greenhouse gas emissions, and hundreds of millions lack access to energy entirely. I chose this article because energy is an intriguing topic to me and also the article contains multiple visualizations that I would like to attempt to recreate and build on top of. Specifically, the key purpose/idea of the article is twofold:

  1. Highlight the inequity in energy access and consumption across the world
  2. Current sources of energy for higher-income countries produce excessive greenhouse gasses

For example, the most prominent KPIs that the article presents are that the production of energy is responsible for 87% of global greenhouse gas emissions and the world’s CO2 emissions have been rising quickly and reached 36.6 billion tonnes in 2018. Furthemore, in relation to country income levels, in countries where people have an average income between $15,000 and $20,000, per capita CO2 emissions are close to the global average (4.8 tonnes CO2 per year). In every country where people’s average income is above $25,000 the average emissions per capita are higher than the global average. I definitely agree completely with the premise of the article, such that this disparity is very apparent and the excessive nature of greenhouse gasses in common sources of energy is a well know problem.

2 Question of Interest

What should be the energy source of the future?

sources

3 Data

Kaggle Link | GitHub Link

My dataset is sourced from Kaggle. I am confident that the dataset is appropriate for my article because the Kaggle repository is sourced and updated weekly from a GitHub repository that was used for the article. Although the dataset is very large, containing over 15,000 rows and 122 columns, I will focus mainly on per capita metrics for all sources of energy, along with country location and GDP per Capita. A data dictionary can be found below, and via this link.

Per the Kaggle repository and the article, the main sources of data are:

  1. Energy consumption (primary energy, energy mix and energy intensity): this data is sourced from a combination of two sources—the BP Statistical Review of World Energy and SHIFT Data Portal.
  2. Electricity consumption (electricity consumption, and electricity mix): this data is sourced from a combination of two sources—the BP Statistical Review of World Energy and EMBER – Global Electricity Dashboard.
  3. Other variables: this data is collected from a variety of sources (United Nations, World Bank, Gapminder, Maddison Project Database, etc.).

3.1 Load Data + Import Libraries

Libraries: shinythemes, gganimate, comprehenr, tidyverse, ggplot2, stringr, plotly, gifski, shiny, dplyr, tidyr, DT

Load Data

energy <- read.csv('energy.csv')

Dimensions

## Dimensions: 17432 122
## # of Columns: 122
## Columns: iso_code country year coal_prod_change_pct coal_prod_change_twh gas_prod_change_pct gas_prod_change_twh oil_prod_change_pct oil_prod_change_twh energy_cons_change_pct energy_cons_change_twh biofuel_share_elec biofuel_elec_per_capita biofuel_cons_change_pct biofuel_share_energy biofuel_cons_change_twh biofuel_consumption biofuel_cons_per_capita carbon_intensity_elec coal_share_elec coal_cons_change_pct coal_share_energy coal_cons_change_twh coal_consumption coal_elec_per_capita coal_cons_per_capita coal_production coal_prod_per_capita electricity_generation biofuel_electricity coal_electricity fossil_electricity gas_electricity hydro_electricity nuclear_electricity oil_electricity other_renewable_electricity other_renewable_exc_biofuel_electricity renewables_electricity solar_electricity wind_electricity energy_per_gdp energy_per_capita fossil_cons_change_pct fossil_share_energy fossil_cons_change_twh fossil_fuel_consumption fossil_energy_per_capita fossil_cons_per_capita fossil_share_elec gas_share_elec gas_cons_change_pct gas_share_energy gas_cons_change_twh gas_consumption gas_elec_per_capita gas_energy_per_capita gas_production gas_prod_per_capita hydro_share_elec hydro_cons_change_pct hydro_share_energy hydro_cons_change_twh hydro_consumption hydro_elec_per_capita hydro_energy_per_capita low_carbon_share_elec low_carbon_electricity low_carbon_elec_per_capita low_carbon_cons_change_pct low_carbon_share_energy low_carbon_cons_change_twh low_carbon_consumption low_carbon_energy_per_capita nuclear_share_elec nuclear_cons_change_pct nuclear_share_energy nuclear_cons_change_twh nuclear_consumption nuclear_elec_per_capita nuclear_energy_per_capita oil_share_elec oil_cons_change_pct oil_share_energy oil_cons_change_twh oil_consumption oil_elec_per_capita oil_energy_per_capita oil_production oil_prod_per_capita other_renewables_elec_per_capita other_renewables_share_elec other_renewables_cons_change_pct other_renewables_share_energy other_renewables_cons_change_twh other_renewable_consumption other_renewables_energy_per_capita per_capita_electricity population primary_energy_consumption renewables_elec_per_capita renewables_share_elec renewables_cons_change_pct renewables_share_energy renewables_cons_change_twh renewables_consumption renewables_energy_per_capita solar_share_elec solar_cons_change_pct solar_share_energy solar_cons_change_twh solar_consumption solar_elec_per_capita solar_energy_per_capita gdp wind_share_elec wind_cons_change_pct wind_share_energy wind_cons_change_twh wind_consumption wind_elec_per_capita wind_energy_per_capita

3.2 Data Dictionary

Load Data Dictionary

dictionary <- read.csv('owid-energy-codebook.csv')

Create GDP per Capita Variable

energy$gdp_per_capita <- energy$gdp / energy$population

3.3 Data Preview

3.4 Data Structure

## 'data.frame':    17432 obs. of  123 variables:
##  $ iso_code                               : Factor w/ 217 levels "","ABW","AFG",..: 3 3 3 3 3 3 3 3 3 3 ...
##  $ country                                : Factor w/ 242 levels "Afghanistan",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ year                                   : int  1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 ...
##  $ coal_prod_change_pct                   : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ coal_prod_change_twh                   : num  NA 0 0 0 0 0 0 0 0 0 ...
##  $ gas_prod_change_pct                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gas_prod_change_twh                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_prod_change_pct                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_prod_change_twh                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ energy_cons_change_pct                 : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ energy_cons_change_twh                 : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ biofuel_share_elec                     : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ biofuel_elec_per_capita                : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ biofuel_cons_change_pct                : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ biofuel_share_energy                   : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ biofuel_cons_change_twh                : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ biofuel_consumption                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ biofuel_cons_per_capita                : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ carbon_intensity_elec                  : int  NA NA NA NA NA NA NA NA NA NA ...
##  $ coal_share_elec                        : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ coal_cons_change_pct                   : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ coal_share_energy                      : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ coal_cons_change_twh                   : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ coal_consumption                       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ coal_elec_per_capita                   : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ coal_cons_per_capita                   : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ coal_production                        : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ coal_prod_per_capita                   : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ electricity_generation                 : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ biofuel_electricity                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ coal_electricity                       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ fossil_electricity                     : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gas_electricity                        : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ hydro_electricity                      : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ nuclear_electricity                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_electricity                        : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ other_renewable_electricity            : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ other_renewable_exc_biofuel_electricity: num  NA NA NA NA NA NA NA NA NA NA ...
##  $ renewables_electricity                 : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ solar_electricity                      : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ wind_electricity                       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ energy_per_gdp                         : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ energy_per_capita                      : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ fossil_cons_change_pct                 : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ fossil_share_energy                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ fossil_cons_change_twh                 : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ fossil_fuel_consumption                : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ fossil_energy_per_capita               : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ fossil_cons_per_capita                 : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ fossil_share_elec                      : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gas_share_elec                         : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gas_cons_change_pct                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gas_share_energy                       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gas_cons_change_twh                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gas_consumption                        : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gas_elec_per_capita                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gas_energy_per_capita                  : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gas_production                         : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ gas_prod_per_capita                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ hydro_share_elec                       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ hydro_cons_change_pct                  : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ hydro_share_energy                     : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ hydro_cons_change_twh                  : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ hydro_consumption                      : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ hydro_elec_per_capita                  : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ hydro_energy_per_capita                : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ low_carbon_share_elec                  : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ low_carbon_electricity                 : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ low_carbon_elec_per_capita             : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ low_carbon_cons_change_pct             : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ low_carbon_share_energy                : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ low_carbon_cons_change_twh             : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ low_carbon_consumption                 : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ low_carbon_energy_per_capita           : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ nuclear_share_elec                     : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ nuclear_cons_change_pct                : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ nuclear_share_energy                   : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ nuclear_cons_change_twh                : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ nuclear_consumption                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ nuclear_elec_per_capita                : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ nuclear_energy_per_capita              : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_share_elec                         : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_cons_change_pct                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_share_energy                       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_cons_change_twh                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_consumption                        : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_elec_per_capita                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_energy_per_capita                  : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_production                         : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ oil_prod_per_capita                    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ other_renewables_elec_per_capita       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ other_renewables_share_elec            : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ other_renewables_cons_change_pct       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ other_renewables_share_energy          : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ other_renewables_cons_change_twh       : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ other_renewable_consumption            : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ other_renewables_energy_per_capita     : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ per_capita_electricity                 : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ population                             : num  5021241 5053439 5085403 5118005 5150814 ...
##   [list output truncated]

3.5 Numerical Summaries

##  energy_per_gdp   energy_per_capita per_capita_electricity gdp_per_capita    
##  Min.   : 0.050   Min.   :      0   Min.   :    0.0        Min.   :   132.1  
##  1st Qu.: 0.842   1st Qu.:   3103   1st Qu.:  641.3        1st Qu.:  1919.8  
##  Median : 1.395   Median :  13777   Median : 2521.3        Median :  4668.7  
##  Mean   : 1.838   Mean   :  29602   Mean   : 4016.8        Mean   :  9504.4  
##  3rd Qu.: 2.345   3rd Qu.:  36714   3rd Qu.: 5591.0        3rd Qu.: 11640.7  
##  Max.   :13.493   Max.   :1676610   Max.   :57661.4        Max.   :225016.7  
##  NA's   :10532    NA's   :8397      NA's   :11933          NA's   :7066      
##  fossil_energy_per_capita gas_energy_per_capita hydro_energy_per_capita
##  Min.   :   124.1         Min.   :     0.0      Min.   :     0.00      
##  1st Qu.: 11247.6         1st Qu.:   443.8      1st Qu.:    85.19      
##  Median : 25509.7         Median :  4082.9      Median :   576.74      
##  Mean   : 32913.4         Mean   : 10255.9      Mean   :  3606.96      
##  3rd Qu.: 40568.7         3rd Qu.: 10359.9      3rd Qu.:  2124.32      
##  Max.   :317582.5         Max.   :278892.4      Max.   :105642.71      
##  NA's   :13148            NA's   :13142         NA's   :13142          
##  low_carbon_energy_per_capita nuclear_energy_per_capita oil_energy_per_capita
##  Min.   :     0.0             Min.   :    0.0           Min.   :   124.1     
##  1st Qu.:   198.2             1st Qu.:    0.0           1st Qu.:  5316.4     
##  Median :  1185.7             Median :    0.0           Median : 12149.0     
##  Mean   :  5636.1             Mean   : 1480.3           Mean   : 16714.3     
##  3rd Qu.:  5047.5             3rd Qu.:  637.7           3rd Qu.: 22639.0     
##  Max.   :146224.5             Max.   :24721.8           Max.   :151237.3     
##  NA's   :13142                NA's   :13142             NA's   :13148        
##  other_renewables_energy_per_capita renewables_energy_per_capita
##  Min.   :    0.00                   Min.   :     0.0            
##  1st Qu.:    0.00                   1st Qu.:   161.5            
##  Median :    7.23                   Median :   727.6            
##  Mean   :  351.50                   Mean   :  4155.7            
##  3rd Qu.:  154.25                   3rd Qu.:  2685.8            
##  Max.   :44322.65                   Max.   :146224.5            
##  NA's   :13142                      NA's   :13142               
##  solar_energy_per_capita wind_energy_per_capita
##  Min.   :   0.000        Min.   :   0.000      
##  1st Qu.:   0.000        1st Qu.:   0.000      
##  Median :   0.000        Median :   0.000      
##  Mean   :  29.375        Mean   : 134.003      
##  3rd Qu.:   0.296        3rd Qu.:   4.745      
##  Max.   :1763.675        Max.   :6928.363      
##  NA's   :13142           NA's   :13142

4 Data Validation

4.1 Correct Data Types

After exploring the structure and descriptive summary of the dataset, it appears that all variables are of the correct data type; specifically, variables like country and ISO code are factor variables and the remaining are numeric. The only variable that would potentially need to be changed is the year column, yet I think it can safely remain as an integer field.

## # of Numeric Columns:  121
## # of Character Columns:  2

4.2 Valid Ranges

Date Ranges

## Earliest Year: 1900
## Latest Year: 2020

4.3 Missing Values Viz

src

4.4 Missing Values Stats

## Total Missing Values: 1453254
## % Missing of Entire Dataset: 67.78
##                                         [,1] 
## iso_code                                0    
## country                                 0    
## year                                    0    
## coal_prod_change_pct                    9987 
## coal_prod_change_twh                    7038 
## gas_prod_change_pct                     12570
## gas_prod_change_twh                     9539 
## oil_prod_change_pct                     10911
## oil_prod_change_twh                     8867 
## energy_cons_change_pct                  7590 
## energy_cons_change_twh                  7540 
## biofuel_share_elec                      13226
## biofuel_elec_per_capita                 13243
## biofuel_cons_change_pct                 16913
## biofuel_share_energy                    13148
## biofuel_cons_change_twh                 11923
## biofuel_consumption                     11806
## biofuel_cons_per_capita                 11806
## carbon_intensity_elec                   16844
## coal_share_elec                         12376
## coal_cons_change_pct                    13670
## coal_share_energy                       13148
## coal_cons_change_twh                    13225
## coal_consumption                        12262
## coal_elec_per_capita                    12673
## coal_cons_per_capita                    13142
## coal_production                         6803 
## coal_prod_per_capita                    7779 
## electricity_generation                  11313
## biofuel_electricity                     13183
## coal_electricity                        12333
## fossil_electricity                      12333
## gas_electricity                         12333
## hydro_electricity                       11313
## nuclear_electricity                     11313
## oil_electricity                         12333
## other_renewable_electricity             11348
## other_renewable_exc_biofuel_electricity 13183
## renewables_electricity                  11348
## solar_electricity                       11313
## wind_electricity                        11313
## energy_per_gdp                          10532
## energy_per_capita                       8397 
## fossil_cons_change_pct                  13231
## fossil_share_energy                     13148
## fossil_cons_change_twh                  13231
## fossil_fuel_consumption                 13148
## fossil_energy_per_capita                13148
## fossil_cons_per_capita                  12673
## fossil_share_elec                       12376
## gas_share_elec                          12376
## gas_cons_change_pct                     13728
## gas_share_energy                        13148
## gas_cons_change_twh                     13225
## gas_consumption                         12262
## gas_elec_per_capita                     12673
## gas_energy_per_capita                   13142
## gas_production                          9366 
## gas_prod_per_capita                     10092
## hydro_share_elec                        11356
## hydro_cons_change_pct                   13768
## hydro_share_energy                      13148
## hydro_cons_change_twh                   13225
## hydro_consumption                       13142
## hydro_elec_per_capita                   11933
## hydro_energy_per_capita                 13142
## low_carbon_share_elec                   11391
## low_carbon_electricity                  11348
## low_carbon_elec_per_capita              11933
## low_carbon_cons_change_pct              13597
## low_carbon_share_energy                 13148
## low_carbon_cons_change_twh              13225
## low_carbon_consumption                  13142
## low_carbon_energy_per_capita            13142
## nuclear_share_elec                      11356
## nuclear_cons_change_pct                 15910
## nuclear_share_energy                    13148
## nuclear_cons_change_twh                 13225
## nuclear_consumption                     13142
## nuclear_elec_per_capita                 11933
## nuclear_energy_per_capita               13142
## oil_share_elec                          12376
## oil_cons_change_pct                     13231
## oil_share_energy                        13148
## oil_cons_change_twh                     13231
## oil_consumption                         12248
## oil_elec_per_capita                     12673
## oil_energy_per_capita                   13148
## oil_production                          8722 
## oil_prod_per_capita                     9508 
## other_renewables_elec_per_capita        11933
## other_renewables_share_elec             11391
## other_renewables_cons_change_pct        15106
## other_renewables_share_energy           13148
## other_renewables_cons_change_twh        13225
## other_renewable_consumption             13142
## other_renewables_energy_per_capita      13142
## per_capita_electricity                  11933
## population                              1756 
## primary_energy_consumption              7298 
## renewables_elec_per_capita              11933
## renewables_share_elec                   11391
## renewables_cons_change_pct              13604
## renewables_share_energy                 13148
## renewables_cons_change_twh              13225
## renewables_consumption                  13142
## renewables_energy_per_capita            13142
## solar_share_elec                        11356
## solar_cons_change_pct                   16107
## solar_share_energy                      13148
## solar_cons_change_twh                   13225
## solar_consumption                       13142
## solar_elec_per_capita                   11933
## solar_energy_per_capita                 13142
## gdp                                     6976 
## wind_share_elec                         11356
## wind_cons_change_pct                    15889
## wind_share_energy                       13148
## wind_cons_change_twh                    13225
## wind_consumption                        13142
## wind_elec_per_capita                    11933
## wind_energy_per_capita                  13142
## gdp_per_capita                          7066

Although it is slightly disconcerting that there are almost 1.5 million missing data points (~68% of the entire dataset), this actually does make sense considering it includes records from 1900. In other words, especially for energy sources like renewable and nuclear and historically underdeveloped countries, it is expected that these NA’s simply indicates the lack of that country using a specific energy source. Therefore, I think it is safe to fill these values with 0.

energy <- energy[
  which(
    energy$year >= 1965 &
    energy$year <= 2016  
  ), 
]
cat("Total Missing Values:", sum(is.na(energy)))
## Total Missing Values: 731235
energy[is.na(energy)] <- 0
## Total Missing Values: 0

4.5 Duplicate Rows

After a quick look at the unique rows in the dataset, it is evident that there are no duplicate rows.

## Number of Unique Rows: 10563
## Number of Total Rows: 10563

5 Plots

5.1 World Energy Use

My main Shiny App aims to highlight the disparity of energy access across the globe. As displayed via the ability to toggle between consumption, production, energy per capita, and share, as well as specific looks into the various energy sources, this disparity holds true for the majority of combinations. An additional function of the App is to show which countries specialize in each of the energy sources, with a great example being coal share energy as of late.

Shiny applications not supported in static R Markdown documents

5.2 Energy Use by Country

The next Shiny App focuses in on country specific energy usage. The user is able to select any country in the world, and a gganimate gif will be created, showing the Energy per Capita for the ten different sources of energy: fossil, gas, hydro, low carbon, nuclear, oil, wind, solar, renewables, and other renewables. This graphic can be helpful to highlight which energy source is most prominent in a nation of interest, as well as to compare between countries. The animation aspect of the plot captures potential trends in energy usage, such that certain sources may be rising or falling in use within a country.

Shiny applications not supported in static R Markdown documents

5.3 Energy per Capita x Population x GDP

5.3.1 Country Specific Plot

My final Shiny App once again focuses in on one country, yet in this plot it specifically looks at Energy per Capita in relation to GDP per Capita. For many countries, the relationship between GDP and Energy per Capita is quite apparent, such that as the nation’s overall wealth increases, there energy (and essentially their access) also increases. One prominent example of this is Brazil. An interesting thing to note though is that for well developed nations, like the United States, this trend does not necessarily appear to hold; specifically, Energy per Capita more randomly fluctuates with changes in GDP per Capita. This makes sense considering less developed nations will experience much larger leaps in energy access as they garner wealth, whereas developed countries will experience diminished returns so to speak.

Shiny applications not supported in static R Markdown documents

5.3.2 3D Global Plot

Finally, I decided to create a 3D Plotly plot, which zooms out to all countries in the world. In order to highlight potential disparities between continents/regions, I loaded in a Continents dataset from Our World in Data. The graphic aims to show the overall trend that increases in GDP per Capita generally will lead to increases in Energy per Capita. Using the play button, you will notice that there are definitely periods where this is more true than not, but overall the trend appears to hold. The last axis, population, although effectively encapsulated in the “per Capita” of both variables, is used to look for a similar trend; overall, it seems that greater populations tend to correlate to greater energy per capita.

Load and Merge Continent Data

continents <- read.csv('owid_continents.csv')
##                  Entity     Code Year Continent
## 1              Abkhazia OWID_ABK 2015      Asia
## 2           Afghanistan      AFG 2015      Asia
## 3 Akrotiri and Dhekelia OWID_AKD 2015      Asia
## 4               Albania      ALB 2015    Europe
## 5               Algeria      DZA 2015    Africa
## 6        American Samoa      ASM 2015   Oceania
## Dimensions:  285 4

Plot

6 Conclusion and Future Work

Overall, the purpose of my work was aimed to highlight the disparity in energy access (a summation of production, consumption, etc.), and the variety of visualizations all confirm the article’s argument of energy inequity. Furthermore, the latter visualizations specifically agree with the statement that countries with higher GDP per Capita will likely have greater energy access and a higher Energy per Capita. Considering energy infrastructure for large populations is not a small investment, this finding does make a lot of sense. Yet, to tie everything back to my initial question of interest, I think that the more important idea is that significant investment is needed to bring equitable energy to all parts of the world, and we need to understand the most cost-effective and safest ways to invest in energy infrastructure in order to not only preserve our environment but also even the “energy playing field.”

For future work, it would be really interesting to look more specifically to energy access, GDP, etc. in relation to emissions data as well as energy-related deaths (accidents and air pollution). When considering what the energy source of the future should be, the safety to humans and the impact they have on the environment need to be considered. Luckily, Our World in Data has extensive sources of data that could easily be tied into the dataset I used for this project; additionally, in addition to the article I chose, there are multiple others that could be examined. For example, visualizations similar to the one below, from Safest Sources of Energy, would be interesting to recreate and build on.

sources

Finally, it is also important to note that there remain many other variables within my dataset that I could have examined, especially considering there were over 100 variables. Looking more specifically at change year-over-year variables could have been useful for highlighting trends.

7 Credits and Licenses

Hannah Ritchie and Max Roser (2020) - “Energy”. Published online at OurWorldInData.org. Retrieved from: ‘https://ourworldindata.org/energy’ [Online Resource]

This data has been collected, aggregated, and documented by Hannah Ritchie, Max Roser and Edouard Mathieu.

All visualizations, data, and code produced by Our World in Data are completely open access under the Creative Commons BY license. You have the permission to use, distribute, and reproduce these in any medium, provided the source and authors are credited. The data produced by third parties and made available by Our World in Data is subject to the license terms from the original third-party authors. We will always indicate the original source of the data in our database, and you should always check the license of any such third-party data before use.