Data
On the census bureau website, all the data is provided by race. For each of the income group datasets, I took the specific race data and combined it into a spreadsheet. Hence there are seven spreadsheets, one for each income group. The income group “Average” is actually not part of the original data, I averaged the data from the 5 existing quintiles to create the data for that spreadsheet. You’ll also notice that the census data includes two white categories: “White” and “White, Not Hispanic”. The specifics of race categorization get a little complicated so if you would like to understand the exact definitions, please use the Census Bureau link above to learn more.
Development Hurdles
This application was developed completely in R. I’m using the Shiny package to create the visualization. Shiny uses a ui and a server file to create a reactive application. What is a reactive application? It’s an application that changes on the fly based on the current inputs. There’s a lot of great documentation on how to develop Shiny applications, check out their main website for more details. If you have a little money to spare, there is a pretty good R tutorial available on Udemy as well. The only thing that really caused me to stumble was the reactive functions in R. Reactive functions create reactive function variables. For example, the first input in my app is “race”, which can be any combination of 0 to 5 options. This vector is actually a function variable as opposed to a standard variable. This means that you have to call it in its function form, so “race()” as opposed to “race”. This tripped me up initially but once you get passed that, Shiny is a fun and not too difficult way to create some pretty cool visualizations.
Hosting Issues
This was another unexpected hurdle I hit. Since I’m using Weebly for my blog which basically steps in for all the complex hosting duties, I had to host this app elsewhere. The Udemy class I purchased above promised a lesson on how to host on Amazon EC2 from Mac OSX but the documentation was outdated so I ended up having to figure it out by myself. Long story short, with quite a bit of effort, I successfully got it hosted on Amazon EC2. I noted the steps so when I have time, I’ll include an A to Z hosting guide for OSX on the blog. An alternative that I wish I had looked into more deeply is hosting directly through Shinyapps.io. They offer a free tier for use with up to 5 applications and 25 hours of usage per month, which if you’re just getting your feet with Shiny, is ideal.