尝试使用 tidycensus 包下载数据。
当我读到它时,tidycensus支持 2000 年的块。区域有效,块组有效,块失败
library(tidycensus)
library(tidyverse)
library(viridis)
library(ggplot2)
library(dplyr)
#------Get Decennial Census Data
ut2000tract <- get_decennial(geography = "tract", variables = "P001001",
year = 2000, sumfile = "sf1", key = mykey, state = "49", county = "035",
geometry = FALSE)
ut2000BG <- get_decennial(geography = "block group", variables =
"P001001", year = 2000, sumfile = "sf1",
key = mykey, state = "49", county = "035", geometry = FALSE)
ut2000block <- get_decennial(geography = "block", variables = "P001001",
year = 2000, sumfile = "sf1", key = mykey, state = "49", county = "035",
geometry = FALSE)
产生以下错误:
1 “正在检查 SF3 API 的数据...” 1 “客户端错误 Bad Request 客户端错误:(400) Bad Request” stri_replace_first_regex(string, pattern, fix_replacement(replacement), 中的错误:参数
str
应该是字符向量(或对象)强制到)gather.default(。,键=变量,值=值,-GEOID,-NAME)中的错误:
找不到对象'NAME'
我知道块应该是有效的几何图形;我只想要人口普查 2000 SF1 文件中的人口/街区计数。不知道为什么 tidycensus 不起作用。提取 2010 年的数据似乎可行。但不是2000。
totalcensus不包括 2000 年人口普查