error: unknown/unsupported geography heirarchy, when querying Census tracts

error: unknown/unsupported geography heirarchy, when querying Census tracts

我正在关注 rcensusapiguide 检索数据以检索人口普查区级数据。这是我的代码。

getCensus(
  name = "acs/acs5/cprofile",
  vintage = 2018,
  key = Sys.getenv("CENSUS_API"),
  vars = c("NAME","CP03_2014_2018_062E"),
  region = "tract:*",
  regionin = "state:12+county:033"
)

但是当我 运行 这段代码时,我得到了这个错误。

 Error in apiCheck(req) : 
  The Census Bureau returned the following error message:
 error: unknown/unsupported geography heirarchy 

这个类似的查询似乎可以提供全县范围的号码。

getCensus(
  name = "acs/acs5/cprofile",
  vintage = 2018,
  key = Sys.getenv("CENSUS_API"),
  vars = c("NAME","CP03_2014_2018_062E"),
  region = "county:033",
  # region = "county",  # to get all counties in FL
  # region = "congressional district",  # to get all congressional districts in FL
  regionin = "state:12"
)

#  state county                     NAME CP03_2014_2018_062E
#1    12    033 Escambia County, Florida               49286

也可以使用上面的备用过滤器获取佛罗里达州所有县或国会选区的值。

但不幸的是,我认为不可能获得此特定查询的区域级详细信息。

https://api.census.gov/data/2018/acs/acs5/cprofile.html https://api.census.gov/data/2018/acs/acs5/cprofile/examples.html

从这些链接的帮助来看,这项调查似乎在地区级别不可用。以下是 hereregion 参数的所列地理级别。 (此外,正如@ThetaFC 在评论中指出的那样,可以使用 listCensusMetadata(name = "acs/acs5/cprofile", vintage = 2018, type = "geography") 直接查询此列表。)