Wednesday, 25 January 2012

Ease of doing business heatmap

I put together a heatmap of the World Bank's ease of doing business rankings using R, which quickly highlights which countries are doing relatively well/badly on a variety of measures.  Singapore come out top, Canada need to do something about their electricity supply, and apparently getting credit seems to be easy in the UK.  I've pasted the R syntax below.












WBBP <- read.csv("WorldBankBestPlaces.csv", sep=",") *reads in csv to 'WBBP' data object
WBBP <- WBBP[order(WBBP$Ease.of.Doing.Business.Rank),] *orders by ranking index
row.names(WBBP) <- WBBP$Economy *labels rows with economy name
WBBP <- WBBP[,2:12] *drops economy name col (not needed after step above)
WBBP_matrix <- data.matrix(WBBP) *converts data frame to data matrix
WBBP_heatmap <- heatmap(WBBP_matrix, Rowv=NA, Colv=NA, col = heat.colors(256), scale="column", margins=c(16,8))

No comments:

Post a Comment