totalcensus icon indicating copy to clipboard operation
totalcensus copied to clipboard

Cannot open URL?

Open BryanSWeber opened this issue 2 years ago • 3 comments

So I am attempting to download several ACS for various specific regions and years, and have came up with the call: Where uniquePlaces is a DF of [cityName, StateAbb]. I am trying to avoid downloading everything in the ACS for all years for obvious reasons - but the calls tend to go to URLs that don't exist.

> acsStored<-read_acs1year(year = 2015,
+               states = unique(uniquePlaces[,2]),
+               areas= paste0(uniquePlaces[,1], " city,", uniquePlaces[,2]),
+               table_contents = c( "income = B19013_001") ) 

Do you want to download 2015 ACS 1-year survey summary files of states NA, AK, KS, ID, IA, CT, NY, NV, SC, LA, PA, MD, MO, OR, NC, OK, NM, OH, MN, NJ, MA, MI, MT, NE, MS, ME, RI, NH, ND, WI, TX, TN, WA, UT, VA, VT, SD, WV, WY and save it to your computer? It is necessary for extracting the data. 1: yes 2: no

Selection: 1 Downloading 1 of 39 states. Downloading NA summary files of ACS 1-year of 2015. trying URL 'https://www2.census.gov/programs-surveys/acs/summary_file/2015/data/1_year_by_state/_All_Geographies.zip' Error in download.file(url, save_as, method = "auto") : cannot open URL 'https://www2.census.gov/programs-surveys/acs/summary_file/2015/data/1_year_by_state/_All_Geographies.zip'

How do I circumvent this error or continue downloading whatever is possible?

BryanSWeber avatar Feb 06 '23 14:02 BryanSWeber

Looks like you have missing state in unique(uniquePlaces[,2])

GL-Li avatar Feb 07 '23 12:02 GL-Li

Ah! Good point. I replaced it with the base R object state.abb and it now runs happily. I run into a bug as I move up the year count, though:

read_acs1year(year = 2020,
              states = state.abb, #All states using a base built-in
              summary_level = 'place',
              table_contents = c( "income = B19013_001") )

It runs into a problem with the 2020 data for Alabama - 

Do you want to download 2020 ACS 1-year survey summary files of states AL, AK, AZ, AR, CA, CO, CT, DE, FL, GA, HI, ID, IL, IN, IA, KS, KY, LA, ME, MD, MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ, NM, NY, NC, ND, OH, OK, OR, PA, RI, SC, SD, TN, TX, UT, VT, VA, WA, WV, WI, WY and save it to your computer? It is necessary for extracting the data.
1: yes
2: no

Selection: 1
Downloading 1 of 50 states.
Downloading AL summary files of ACS 1-year of 2020.
trying URL 'https://www2.census.gov/programs-surveys/acs/summary_file/2020/data/1_year_by_state/Alabama_All_Geographies.zip'
Error in download.file(url, save_as, method = "auto") : 
  cannot open URL 'https://www2.census.gov/programs-surveys/acs/summary_file/2020/data/1_year_by_state/Alabama_All_Geographies.zip'
In addition: Warning messages:
1: In download.file(url, save_as, method = "auto") :
  downloaded length 0 != reported length 18282
2: In download.file(url, save_as, method = "auto") :
  cannot open URL 'https://www2.census.gov/programs-surveys/acs/summary_file/2020/data/1_year_by_state/Alabama_All_Geographies.zip': HTTP status was '404 Not Found'

Is there a point where the data isn't available, perhaps?

BryanSWeber avatar Feb 07 '23 16:02 BryanSWeber

No 2020 1-year ACS data due to COVID.

GL-Li avatar Feb 09 '23 13:02 GL-Li