MC0240
MC0240

Reputation: 1

ACS package in R: Lots of missing counties

I am trying to find a clean way to pull some county-level census data into R, and I downloaded the acs package. I tried using the acs.fetch function to get some basic age/sex data for each county in Missouri. The function only gave back about 12 counties and Missouri has over 100.

I saw on a previous post that some counties might not have any data on a one-year ACS survey, but this seems like too many blanks. And, when I cross-checked this with a search for the same information in the American Fact Finder, it seemed like I was missing a lot in R. The code I tried is below.

library(acs)
acs.fetch(geography=geo.make(state="MO", county="*"), table.number ="B01003", endyear=2014, span=1)

Quick disclaimer: I am a beginner in R, and my vocabulary on the topic will be a bit limited.

Upvotes: 0

Views: 261

Answers (1)

sconfluentus
sconfluentus

Reputation: 4993

I just ran your snipped of code and saved it to variable x and there were indeed only 17 counties listed for that particular table. Just to be sure I then ran it as a 5-year estimate with a slight modification:

    library(acs)
  acs.fetch(geography=geo.make(state="MO", county="*"), table.number ="B01003", endyear=2014, span=5  

When I did so, I received 115 counties:

str(x2@geography$NAME)
chr [1:115] "Adair County, Missouri" "Andrew County, Missouri" "Atchison County, Missouri" ..

So the single year estimate does not have what you are looking for at the county level, you will either need to adjust to work with 5-year estimates of find another source. But your code seems correct. .

Upvotes: 1

Related Questions