How a country powers itself reveals policy, economic priorities

[This article was first published on R – NYC Data Science Academy Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Energy is a core sector

Businesses from agriculture to tech rely on energy. Governments often generate or own power plants as well as craft energy policy. Expanding the energy sector while reducing greenhouse gas emissions for a power-hungry planet has been a topic of discussion for the past several decades.

Understanding how a country generates its power in a case study can lead to trade insights for a given region. Emerging trends also highlight policy priorities.

So, I built an app that could be used by economists and policymakers alike to support their own efforts to explore global electricity trends.

The UN Energy Statistics Database

The United Nations Statistics Division has collected energy-related information and shared it through the Energy Statistics Database in the UNdata portal. I came across this dataset on Kaggle, where I downloaded energy statistics data for this app.

I focused on electric capacity from this rich dataset because a power plant represents a significant capital expenditure (as either a public or private sector investment) and profit margins are tight. In other words, power plants have to operate efficiently over many years to be profitable – implying consistent use. Building a certain type of power plant also represents a significant, long-term commitment to that energy strategy.

The Electricity Explorer app

Scatterplot of changes in electric capacity by country

Selecting countries in the Electric Explorer app

A country’s absolute vs relative net changes in electricity power plant capacity is visualized on the first tab. Users can search for trends and countries they are curious about by brushing over points on the graph which identifies countries below. Countries with high absolute capacity changes, like the USA, China and India, are on the far right of this graph. Countries which have significantly increased their relative capacity are on the top of this graph, like the Maldives.

Alternative energy development

Changes in alternative energy capacity over time is visualized on the second tab. I calculated an index which reflects the amount of alternative electricity capacity normalized by total electricity capacity. Clicking the play button animates this graph, showing changes in this distribution by year.

Many countries have relied heavily on energy production from combustible fuels, so these distributions are skewed. Over time, distributions shift for most regions – possibly due to international efforts to expand alternative energy initiatives. The Oceania region appears to exhibit the most dramatic investment in alternative energy electricity capacity.

Breaking down capacity by country

Germany electric power capacity by type, 1999 - 2014

Germany has invested in wind, and more recently, solar power capacity

Previous tabs enable the user to quickly explore countries and regions for changes in electricity capacity – leading to questions about particular countries. On the third tab, the user can select or type in a country of interest. This generates a graph which breaks down electric capacity in detail: fossil fuels, solar, wind, nuclear, and so on.

Some interesting trends to check out include:

  • Japan increasing solar investment as nuclear power lagged after the Fukushima disaster in 2011
  • Italy replacing some of its combustible electric plant capacity with solar
  • Norway relying on hydrothermal for decades, but increasing combustible power plant capacity up to 2010


I built an app designed to help users interested in electricity to quickly learn about a country they are interested in. This app helps initiate more questions about energy policy and trade. These questions can be answered through targeted, follow-up investigation of the larger UN Energy Statistics Database. Check the app out here, and thanks for reading.

To leave a comment for the author, please follow the link and comment on their blog: R – NYC Data Science Academy Blog. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)