Visualizing the Fragile State Index 2016

[This article was first published on R – Jesse Piburn, 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.

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 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)