This blog exists purely as a place for me to dump random links and thoughts I have rather than emailing them to my friends. It'll have large amounts of inside jokes. Also there will probably be times when I write "you" or refer to an email. Just pretend that you are reading an email to you. If you don't know me you likely won't find anything here interesting. If you do know me you also will not find anything here interesting.
Sunday, August 24, 2014
Cost of Living
Recently, someone posted a map of the cost of living for states in the US. The issue was that the state level is way too high to look at that. I decided to do it at the county level.
First I had to find a data source for the cost of living at the county level. I found this site, which seems to have good county level data. I wrote a script to scrape that data, and then had a csv with the cost of living and fips code for every county.
For plotting I followed this R tutorial. It was easy enough to follow/adapt, but I noticed the result looked odd. It was much more random than I would have expected, and some spot checking confirmed the plot was wrong. It took me quite a while to figure out there were a few counties that are out of order in the maps package. This still doesn't make sense as I used a match command so they should all be matched up. Either way, I finally got an R script that plotted the data correctly.
The code and data are up on github.
Nice!
ReplyDelete