Monthly Archives: January 2014

acs.R version 1.2: Now, with 2012 data

Posted by Ezra Glenn on January 22, 2014
Census, Code, Self-promotion / No Comments

As some of you have noticed, the new five-year Census ACS data has just come out, and is now available via the Census API. To make sure you are able to fetch the freshest possible data to play with in R, I’ve updated the acs.R package to version 1.2, which now includes full support for the 2008–2012 ACS data.

The latest version is now available on the CRAN repository. If you’ve already installed the package in the past, you can easily update with the update.packages() command; if you’ve never installed it, you can just as easily install it for the first time, by simply typing install.packages(“acs”). In either case, be sure to load the library after installing by typing library(acs), and install (or re-install) an API key with api.key.install() — see the documentation and the latest version of the acs user guide for more info.

To get the latest data, just continue to use the acs.fetch() function as usual, but specify endyear=2012. (By default, endyear is set to 2011 if no year is explicitly passed to acs.fetch, and I didn’t want to change this for fear of breaking existing user scripts. In the future, we might to rethink this, so that it selects the most recent endyear by default. Thoughts?)

(Note: If you’re not sure which version you are using, you can always type packageVersion(“acs”) to find out.)

New choropleth package in R

Posted by Ezra Glenn on January 22, 2014
Census, Code, Free Software, Open-Source / No Comments

A while back I posted a recipe (based on some great examples on the Revolution Analytics blog) showing how to use the acs package in R to create choropleth maps. Now, through the magic of open-source software development — and the hard work of developer Ari Lamstein and the generosity of his employers — this process has gotten even easier: I call your attention to Ari’s new chorolethr package for R.

Ari is a Senior Software Engineer at Trulia, where he works on data science and visualization, primarily related to real estate and housing markets. As part of the company’s “Innovation Week” he developed the choropleth package, moving well beyond the sample scripts to create a powerful suite of mapping functions. With a single command, a user can now generate maps at the state, county, or zip code level, from any of the data available via the ACS.

The package is not yet up on CRAN, but Ari promises that’s in the works; for now, you can learn more about it — including installation instructions using install_github() — on the Trulia Tech + Design blog. (I’m of course proud to note that the acs.R package lies at the foundation of these tools, doing the heavy-lifting of fetching and processing up-to-date data from the American Community Survey — but Ari’s work is already moving beyond these humble roots, allowing users to create choropleth maps of any data they can get their hands on….)

To learn more about the types of projects undertaken by Trulia staffers during Innovation week, see this short video. Congratulations — and thanks — to both Ari and Trulia for helping to drive innovation forward in R and other open source projects.