Visualizing the Fragile State Index 2016

September 18, 2016
By

(This article was first published on R – Jesse Piburn, and kindly contributed to R-bloggers)

Every year the Fund For Peace produces the Fragile State Index, a list that scores each nation across 12 social, economic, and political dimensions with the sum of these scores being a total measure of that nations vulnerability to collapse. While the most fragile nations tend to always have high (bad) scores across all dimensions, this isn’t always the case. For example, Guinea Bissau is the 17th most fragile nation overall, but has a Group Grievance score, which measures discrimination, ethnic and religious violence among other things, that is lower (better) than the United Kingdom, 162nd most fragile nation.

I thought it would be interesting to take a quick look at the 12 dimensions and see if anything interesting popped out. The code to reproduce this chart is at the bottom of the article.


Thanks  to the readxl and d3heatmap r-packages, creating this visual is pretty simple.

library(readxl)
library(d3heatmap)

# download and read in the data -----
dest_file <- "data/fragilestatesindex-2016.xlsx"
download.file("http://fsi.fundforpeace.org/library/fragilestatesindex-2016.xlsx", 
              destfile = dest_file, mode="wb")
df <- read_excel(dest_file)

# clean up the data -----
df <- df[, 2:ncol(df)]
names(df)[1] <- "country"
df <- df[!is.na(df$country), ]
row.names(df) <- df$country
df$country <- NULL
df$Total <- NULL

# reverse the colors from red to blue to blue to red -----
BuRd <- rev(RColorBrewer::brewer.pal(name = "RdBu", n = 11))
d3heat <- d3heatmap(df, scale="column", colors = BuRd, dendrogram = "none", 
                    xaxis_font_size = "6pt", yaxis_font_size = "7pt",  width = 600, height = 1800)

# save the results -----
htmlwidgets::saveWidget(d3heat, "d3heatmap.html")

 

 

To leave a comment for the author, please follow the link and comment on their blog: R – Jesse Piburn.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Sponsors

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)