[acs-r] How to include STATE and COUNTY FIPS codes in ACS.FETCH

Ezra Haber Glenn eglenn at mit.edu
Fri Oct 17 13:33:51 EDT 2014


Good question -- thanks for the email.  

The answer is: the FIPS codes are already in there.  When acs.fetch
gets data, it also retrieves some geographic info (in addition to the
written place names).  This geographic data is stored in the acs.class
object, but not shown by default.  To see it, use:

> geography(us.fb)

In this example, there will be three columns: NAME, state, and county.
The last two use standard FIPS codes, and can be merged to form more
complex GEOIDs.

To learn more about what's bundled into an acs.class object, try this:

> str(us.fb)

Enjoy!

At Fri, 17 Oct 2014 13:00:32 -0400, Nevin Krishna wrote:
> 
> [1  <multipart/alternative (7bit)>]
> [1.1  <text/plain; UTF-8 (7bit)>]
> 
> [1.2  <text/html; UTF-8 (quoted-printable)>]
> Hi All,
>  
> The following code extracts key ACS variables for a given state. The geographic variables
> in "us.fb" are the "spelled out" state and county names. Since I am using this data to
> eventually merge with other datasets by geography I would like to use something a
> little less error prone than the spelled out counties. I am wondering if and how I
> can retrieve the FIPS codes for state and County in the acs.fetch function. 
>  
> library(acs)
> us.county=geo.make(state="GA", county="*")
> us.fb= acs.fetch(geography=us.county, variable=c("B05006_110","B05006_111","B05006_112"),
> endyear=2012)
> us.fb
> 
> Thanks for any advice!
> Nevin
> 
> 
> [2  <text/plain; us-ascii (7bit)>]
> _______________________________________________
> acs-r mailing list
> acs-r at mit.edu
> http://mailman.mit.edu/mailman/listinfo/acs-r

--
Ezra Haber Glenn, AICP
Department of Urban Studies and Planning
Massachusetts Institute of Technology
77 Massachusetts Ave., Room 7-337
Cambridge, MA 02139
eglenn at mit.edu 
http://dusp.mit.edu/faculty/ezra-glenn | http://eglenn.scripts.mit.edu/citystate/
617.253.2024 (w)
617.721.7131 (c)


More information about the acs-r mailing list