Easy Data Mapping using R
Today I set myself a little mini-project: learning how to use some of the many mapping tools available for R. I generally am cautious of those cool-colored maps (called “choropleths”), since they’re very easy to fool people with. Apparently something in peoples’ heads just shuts down their critical reasoning faculties when they look at one of those maps. Still, they’re super-cool and can be an easy and effective way to communicate visual data. After spending the morning tooling around with some of the tools available and state income data I had on hand, I managed to whip up a nice little graph on personal income growth in 2013. It’s pretty neat and does communicate the data well – you can really see the huge impact the early 2010s shale boom had across the Great Plains (and PA/WV).
So, some basic insights and suggestions: if you’re working with well-known entities, the choroplethr package is great (thanks to the good people at Trulia!). It has built-in functionality and maps for countries, US states, and counties as well as integration with the American Community Survey (ACS) data. It requires a little work to get the data properly packaged, but it handles the hard stuff for you. If you’re interested in doing custom maps at a lower level or of other countries, maptools and ggmap are very robust. ggmap in particular has very handy Google maps integration, which produces less pretty maps that might be much more practical for some purposes (e.g., commercial). In general, the graphics settings on maps are quite finicky, and it can be a lot of work to get something the way you want (e.g., the gradient scale on the map above). Most of these packages are based on ggplot, and so time invested in ggplot can be very helpful.
Maps are cool! I hope to further incorporate these into both academic and non-academic work in the future.