Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Choropleth maps are a popular way of representing spatial or geographic data, where a statistic of interest (say, income, voting results or crime rate) are color-coded by region. R includes all of the necessary tools for creating choropleth maps, but Trulia's Ari Lamstein has made the process even easier with the new choroplethr package now available on github. With couple of lines of code, you can easily convert a data frame of values coded by country, state, county or zip code into a choropleth like this:
The chart above shows the US zip codes with the highest per-capita incomes, based on data from the US Census Bureau's American Community Survey. The choroplethr package also includes an interface to ACS data, so if you know the data code you're looking for, you can create a choropleth of your favourite US demographic statistic with just a single line of code, like this:
choroplethr_acs(tableId="B19301", lod="zip")
You can read more information about the capabilities of the choroplethr package at the Trulia Tech+Design Blog. Many thanks to Trulia and Ari Lamstein for supporting the development of this useful package!
Trulia Tech+Design Blog: The choroplethr package for R
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.