Today I finished two projects that had been on my mind for a while:
You can see the resulting shiny app here. The app lets you create a scatterplot of any pair of demographic variables that ship with the choroplethr package. When you roll over a point, it tells you where it is. It also adds a trend line.
Here are some examples. Note that while the graphics in the app are interactive, these images are static.
As states get whiter, they also get older:
As counties get older, they also get wealthier:
As ZIP Codes (ZCTAs) get more hispanic, they tend to get younger:
Here are some fun facts I learned from the app:
After spending some time with the app I now have a lot less confidence in the ZIP data than I used to – too many ZIPs have a median age below 10 or over 90. Presumably that could be addressed by looking at the error bars of the underlying data (a major purpose of the acs package). That just wasn’t the purpose of this project.
The code for the app is available here.
If you see any interesting correlations or outliers, please comment below! I’m also interested in learning about more options for interactive graphics in R. If you know of other libraries for doing similar work, please also leave a comment as well.