US Counties – Race/Ethnicity (using choroplethr R package)

March 23, 2017

(This article was first published on R Analysis – Analyst at Large, and kindly contributed to R-bloggers)

As a statistician, I’ve always had a soft spot in my heart for the US Census. I love the rich data sets that are made publicly available and I’ve often experimented with visualizing the results. A couple of months ago, Ari Lamstein (formerly a data scientist at Trulia) released the choroplethr package on CRAN (a repository for R packages). I’ve used it a handful of times and found it to be simple and intuitive. Only a couple of simple commands are required to build plots like this:

Here are a couple simple steps for making use of this excellent package!

1) Go to to get a ACS API key.
2) Visit to find the appropriate ACS table ID for the attribute that you’re looking to explore.
3) Open up R, install choroplethr package, define your API key using the api.key.install() command
4) Explore away!

I started looking at the US population split by ethnicity.

We can see very clearly the heavier concentrations of African-Americans in the Southeastern states, the Eastern seaboard and Southern CA. Asian-American population centers are focused on the West Coast and the NE Coast.

The R code is shown below:


To leave a comment for the author, please follow the link and comment on their blog: R Analysis – Analyst at Large. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)