I created my first app using RStudio and the Shiny library. Shiny is an amazing set of tools that allows you to get your data analysis out into the real world with a reactive GUI. I used a set of tutorials available at http://shiny.rstudio.com/tutorial/ from Rstudio to learn how to put together a Shiny App.
The Shiny app is built out of two parts, server.R and ui.R. The ui.R sets up the UI, how the page will be laid out, the inputs (you get all the options including lists, checkboxes, radio buttons, text boxes etc) and the outputs (here you can put text, plot outputs and more). The server filer contains all of the behind the scenes work for your app. This is where I do my data munging and prepare the plots and maps. You can also load a helper function to split up your app. The amazing part about using Shiny is that you can leverage the amazing power of R for your data analysis and then display the results rapidly.
For this project I used a dataset I have which contains businesses in various categories and sales volume information. I used dplyr to select the top 20 business categories by sales and then create a list. This list is then displayed for the user in the app. Once they pick a business category I again use dplyr to calculate the top ten businesses (if it is a chain store it will calculate total sales for that chain).
The final app showing the selection of business categories, a map and bar chart to help you explore the data.
The next step is the real fun. I used choroplethr to create a custom map for the city I am using. I then aggregate the data so that I can map the sales volume per census division area. This is then displayed in the app. Next I wanted to compare all of the chains on a by store basis. I again aggregate then split the data to compare the average sales per store in a bar graph. The last plot breaks down the sales per chain and displays it in a pie graph so that you can see the market share for each company.
This has allowed me to create a powerful tool that allows you to quickly explore the different business categories and where they are located within the city.
To see the app use the following link:
Please note, that I only have a limited number of credits so the app may go down. If its down and you really want to see it, contact me and I can get you the R files to run it locally.