我想从我数据中的地址中获取一个城市的人口普查代码。问题是我找不到佛罗里达州盖恩斯维尔的可用 shapefile。所以我试图使用参加调查的人的地址来获取人口普查代码,一旦我有了人口普查代码,我会substr
使用前 11 位数字来匹配tidycensus
包裹的 GEOID,这使县人口普查和 shapefile 降到最低的层次结构。
因为我只有城市居民的 GEOID,所以我会得到那些 shapefile,而不是整个县。所以我做了以下只是为了获得人口普查代码:
library(tigris)
library(readr)
gainsville_df2 <- readr::read_csv("311_Service_Requests__myGNV_.csv")
#gainsville_df2 is the dataframe of the csv file
jio<- apply(gainsville_df2["Address"], 1, function(row) tigris::call_geolocator(row, "Gainesville", "FL", zip = NA))
#It ran for ~1.5 hours, parsing through 1892 addresses, then I got this error out of nowhere:
#Error in tigris::call_geolocator(row, "Gainesville", "FL", zip = NA) :
# Internal Server Error (HTTP 500).
#Called from: httr::stop_for_status(r)
数据链接在这里。我有 ~9200 个地址要解析,这发生在 ~1800 年。环顾四周,我发现需要一些超时设置,不幸的是,我不知道该怎么做。
我需要 shapefile 来完成我个人项目的关键部分。