2017-03-04 12 views
0

다음 작품 :R 패키지 ACS를 사용하여 SF1에서 국가 및 ZCTA 수준의 추정치를 얻을 수없는 이유는 무엇입니까?

acs::acs.fetch(dataset = "acs", 
       endyear = 2015, 
       span = 5, 
       geography = acs::geo.make(zip = "*"), 
       variable = "B01001_001") 

그래서이 수행합니다 추적이 작동하지 않는 이유가 아니기 때문에에서 사용할 우편 번호 수준 추정이 없기 때문에

acs::acs.fetch(dataset = "sf1", 
       endyear = 2010, 
       span = 0, 
       geography = acs::geo.make(state = "*"), 
       variable = "PCT0120001") 

, 나에게 설명해주십시오 센서스 API. 센서스 API에서 sf1 및 acs5보다 국가 및 ZCTA 수준 추정치를 얻으려면 지리를 다르게 지정해야합니까?

acs::acs.fetch(dataset = "sf1", 
       endyear = 2010, 
       span = 0, 
       geography = acs::geo.make(zip = "*"), 
       variable = "PCT0120001") 
# Error in file(file, "rt") : cannot open the connection 
# In addition: Warning message: 
# No data found at: 
# http://api.census.gov/data/2010/sf1?key=2dd03c4048ca2edb8463d8c0bbdc09c5eb3b4013&get=PCT0120001,NAME&for=zip+code+tabulation+area:* 

acs::acs.fetch(dataset = "sf1", 
       endyear = 2010, 
       span = 0, 
       geography = acs::geo.make(us = "*"), 
       variable = "PCT0120001") 
# Error in file(file, "rt") : cannot open the connection 
# In addition: Warning message: 
# No data found at: 
# http://api.census.gov/data/2010/sf1?key=2dd03c4048ca2edb8463d8c0bbdc09c5eb3b4013&get=PCT0120001,NAME&for=us:* 

답변

0

2010 년 십년 인구 조사 API의 제한 사항입니다 나타납니다 - 데이터는 미국 전체에 대한 API를 통해 사용할 수 없으며, ZCTA 데이터 상태에 의해에만 사용할 수 있습니다. http://api.census.gov/data/2010/sf1/geography.html을 참조하십시오.

0

totalcensus package을 사용하면 요약 파일을 다운로드하고 각 우편 번호에서 데이터를 추출 할 수 있습니다. 데이터는 사용자 컴퓨터에 다운로드되므로 센서스 API로 데이터에 대한 액세스가 제한되지 않습니다.

library(totalcensus) 
aaa <- read_decennial(
    year = 2010, 
    states = "US", 
    table_contents = "PCT0120001", 
    geo_headers = "ZCTA5", 
    summary_level = "860" 
) 


print(aaa) 

#    lon  lat ZCTA5 state population PCT0120001 GEOCOMP SUMLEV 
#  1: -66.74996 18.18056 00601 NA  18570  18570  all 860 
#  2: -67.17613 18.36227 00602 NA  41520  41520  all 860 
#  3: -67.11989 18.45518 00603 NA  54689  54689  all 860 
#  4: -66.93291 18.15835 00606 NA  6615  6615  all 860 
#  5: -67.12587 18.29096 00610 NA  29016  29016  all 860 
# ---                  
# 33116: -130.04103 56.00232 99923 NA   87   87  all 860 
# 33117: -132.94593 55.55020 99925 NA  819  819  all 860 
# 33118: -131.47074 55.13807 99926 NA  1460  1460  all 860 
# 33119: -133.45792 56.23906 99927 NA   94   94  all 860 
# 33120: -131.60683 56.41383 99929 NA  2338  2338  all 860