I have been wanting to do something with the R package Shiny for a while, and in my case I found the right dataset from The World Bank’s Doing Business website. So for the dataset I basically went for only the portion for ‘Starting a Business’.
The visualisation I had in mind was a heatmap, where the value (or as some visualisation tools call it, measurement), will be in shades of a colour that deepens/lightens with the value. The thing is I had this done in Tableau in minutes. But Tableau is, well, not free. So I thought, a good opportunity to compare how Shiny fares to build a sort of interactive visualisation.
For the design, I already knew I wanted to be able to select one of the indicators (aka measurement) i.e. Number of Procedures, Time in Days, Cost and Paid in minimum capital. The rows would be made up of the economy, the value of the selected indicator in different years and each cell would be filled with varying intensity based on the value.
As a tiny improvement, I added a slider for the user to select the range of the indicator that he wants to include in the table cum heatmap. And of course the slider’s maximum and minimum values will depend on the max and min of the selected indicator.
The first challenge was to cast the dataframe properly into the right table. The second, to use ggplot for the heatmap rendering. The last challenge which took up most of my time was trying to subset the dataframe properly based on the selected indicator and input range. After scouring all over the web and R Shiny google group, I finally got a break from the “Stock” demo (source code here) from the RStudio’s Shiny website.
The app looks like this. In the next post I will show the R code for the app.