0

I'm pulling multiple years of census data for a paper that I'm working. I'm want to pull the same variables from 2009 to 2016, 5-year Estimates at the census tract level in the state of New York. I've successfully run the script for 2016 and 2015, but it keeps giving me an error for 2014 or earlier.

While, I'm trying to pull the same variables, I realize that a few of them change from year to year, but I've already addressed those changes in the code and there weren't any changes in the variable that I'm using between 2014 and 2015, but I'm still having problems. R keeps giving me this error message:

Error: Your API call has errors. The API message returned is There was an error while running your query. We've logged the error and we'll correct it ASAP. Sorry for the inconvenience..

It almost sounds like it's an error on their end?

ACS.2014.vars <- get_acs(state = "NY", 
                 geography = "tract", 
                 year = 2014,  
       variables = c(pop = "B01003_001", 
              male = "B01001_002", 
              female = "B01001_026", 
              m_ag18to19 = "B01001_007", 
              m_ag20 = "B01001_008",  
              m_ag21 = "B01001_009", 
              m_ag22to24 ="B01001_010", 
              m_ag25to29 = "B01001_011", 
              m_ag30to34 = "B01001_012", 
              f_ag18to19 = "B01001_031", 
              f_ag20 = "B01001_032",  
              f_ag21 = "B01001_033", 
              f_ag22to24 ="B01001_034", 
              f_ag25to29 = "B01001_035", 
              f_ag30to34 = "B01001_036", 
              nhwht = "B03002_013", 
              mhinc = "B19013_001", 
              emp = "C24010_001", 
              m_profmgmt = "C24010_003", 
              f_profmgmt = "C24010_039",
              pop25up = "B15002_001", 
              m_col = "B15002_015", 
              m_ma = "B15002_016",
              m_pd = "B15002_017", 
              m_phd = "B15002_018", 
              f_col = "B15002_032", 
              f_ma = "B15002_033",                  
              f_pd = "B15002_034", 
              f_phd = "B15002_035",
              blt = "B25034_001", 
              blt2010orlater = "B25034_002", 
              blt2000to2009 = "B25034_003", 
              blt1990to1999 = "B25034_004", 
              blt1980to1989 = "B25034_005", 
              hu = "B25002_001", 
              occ = "B25002_002", 
              vac = "B25002_003",
              moveintot = "B07001_001", 
              stayed = "B07001_017", 
              moveincounty = "B07001_033", 
              moveinstate = "B07001_049", 
              moveindiffstate = "B07001_065", 
              moveinabroad = "B07001_081"),
              geometry = TRUE, 
              output = "wide")

Like I said, this exact code worked with 2016 and 2015 pulls, but is not working with 2014 or earlier years. So, it's not my census API key since I've already pull some data and I even tried with a new key and that still didn't work. Is there a limit on much data you can pull from Census using the API Key--I realize that this is a lot. I'm not missing any "," or "()" so I don't think the error is in my syntax and spacing or entering on a new line shouldn't be a problem.

I also created a vector of my variables and ran the call with the vector and that didn't work either.

When I run the code, it thinks for about a minute and then returns the error. I've tried it with and with our the geometry and the wide output. My internet connection seems to be working fine, but could the previous calls have throttled down my internet speed and that is why it's throwing the error?

halfer
  • 19,824
  • 17
  • 99
  • 186
kaseyzapatka
  • 149
  • 2
  • 9
  • That error indicates an issue with the Census API, and not your tidycensus code. I just tried running the code you included and it worked just fine, so it was likely just a temporary problem with the API. – mfherman Sep 30 '19 at 17:21
  • 1
    Great. I ran it successfully a few days ago, but wasn't sure enough to conclude it was Census API. Thanks for the help. – kaseyzapatka Sep 30 '19 at 21:31

0 Answers0