从美国社区调查 (ACS) 2013-2017 摘要文件中的所有表中下载所有变量,用于一个州的所有人口普查区块组

Download all variables from all tables in the American Community Survey (ACS) 2013-2017 summary file for all census block groups in a state

我已经在此处下载了堪萨斯州 2013-2017 年美国社区调查 (ACS) 的原始摘要文件数据:https://www2.census.gov/programs-surveys/acs/summary_file/2017/data/5_year_by_state/Kansas_Tracts_Block_Groups_Only.zip

然后我将其解压缩到我工作目录中的文件夹 "acs_2017_5_year" 和 运行 此代码:

library(totalcensus)

#### raw acs data import ####
set_path_to_census("acs_2017_5_year")

trying_acs <- read_acs5year(
  year = 2017,
  states = "KS",
  table_contents = "*",
  summary_level = "block group", 
  with_margin = TRUE
) 

然后我得到这个错误:

Error in read_acs5year_geoheaders_(year, states, table_contents, geo_headers,  : 
  The table content reference * does not exist.

如何下载堪萨斯州所有表中的所有变量? table_contents 字段中的内容是什么?如果没有简单的方法来指示 "all the variables!" 存在,是否有一个方便的列表,其中包含我可以放入大量向量的某处的所有变量名称?我一直找不到任何一个。谢谢!

您应该已经下载了 KS 2017 ACS5year 的所有内容。为了提取特定的 table_contents(或变量),您需要提供对参数 table_contents 的引用。 运行 search_tablecontents("acs5") 找出参考文献。有超过 26000 个变量,因此将它们全部提取到一个 data.table.

中是不现实的