hrecht / censusapi

R package to retrieve U.S. Census data and metadata via API
https://www.hrecht.com/censusapi/
169 stars 30 forks source link

Getting firm creation by msa? #56

Closed markchand closed 5 years ago

markchand commented 5 years ago

Hi! Am so grateful for this repo--so helpful. I hit a snag when trying to get business starts by MSA (I had hoped for county, but I think that's not in this dataset). Any advice or pointers welcome! Here is the code I failed to run:

new_firms_MSA <- getCensus(name = "timeseries/bds/firms",
                 vars = c("firms", "emp", "fage4", "estabs_entry"),
                 region = "msa:*",
                 time = 2014)

That gave me the following error:

error: unknown/unsupported geography heirarchy

Here is a query that worked:

firms_states <- getCensus(name = "timeseries/bds/firms",
                 vars = c("firms", "emp", "fage4","estabs_entry"),
                 region = "state:*",
                 time = 2014)

Apologies if this isn't the right place to ask a question--happy to post somewhere else if helpful.

markchand commented 5 years ago

Sorry, disregard--I just tried the following, and (I think) it worked!:

new_firms_MSA <- getCensus(name = "timeseries/bds/firms",
                 vars = c("firms", "emp", "fage4", "estabs_entry"),
                 region = "metropolitan statistical area:*",
                 time = 2014)