我想使用acs包调用R中的Data Profile表,但我不确定这是否可行。我的代码在下面。我已经用代码调用了B表,没有问题。我认为问题在于我没有在acs.fetch函数中提供正确的信息。DP表的地址为https://api.census.gov/data/2009/acs/acs5/profile其具有/acs5之后的/profile(对于B表,它在这里停止(。有人知道如何使用acs包来调用DP表吗?
library(acs)
# **Create the set of geographies**
kc_tracts<-geo.make(state="WA",county=c(33), tract="*")
# **Download DP table**
DP02<-acs.fetch(endyear=2009,span=5,geography=kc_tracts,table.number="DP02")
我不知道acs
库。tidycensus
可以这样得到DP02:
sVarNames <- load_variables(2018, "acs5/subject", cache = TRUE)
pVarNames <- load_variables(2018, "acs5/profile", cache = TRUE)
otherVarNames <- load_variables(2018, "acs5", cache = TRUE)
head(pVarNames)
## # A tibble: 6 x 3
## name label concept
## <chr> <chr> <chr>
## 1 DP02_00… Estimate!!HOUSEHOLDS BY TYPE… SELECTED SOCIAL CHARACTE…
## 2 DP02_00… Percent Estimate!!HOUSEHOLDS… SELECTED SOCIAL CHARACTE…
## 3 DP02_00… Estimate!!HOUSEHOLDS BY TYPE… SELECTED SOCIAL CHARACTE…
## 4 DP02_00… Percent Estimate!!HOUSEHOLDS… SELECTED SOCIAL CHARACTE…
## 5 DP02_00… Estimate!!HOUSEHOLDS BY TYPE… SELECTED SOCIAL CHARACTE…
## 6 DP02_00… Percent Estimate!!HOUSEHOLDS… SELECTED SOCIAL CHARACTE…
参见https://walker-data.com/tidycensus/articles/basic-usage.html
以及https://geodacenter.github.io/opioid-environment-toolkit/getACSData-tutorial.html