Downloaded Census Data using R

自作多情 提交于 2020-01-06 19:36:13

问题


I am trying to download only the table shown on this link:

http://factfinder.census.gov/faces/tableservices/jsf/pages/productview.xhtml?src=CF

but have not had success with the following code:

library(RCurl)

step1 = "http://factfinder.census.gov/faces/tableservices/jsf/pages/productview.xhtml?src=CF"

step2 = getURL(step1)

step3 = read.txt(textConnection(step2), header = FALSE)

Any thoughts would be greatly appreciated!


回答1:


If I were you, I would immediately download acs a wonderful package written by Ezra Glenn at MIT. Install it, give it the codes you need and it will bring in exactly the data you want in an S4 object that can be mathematically manipulated and mapped.

here is the Cran documentation. I just completed a 3 week project mapping social vulnerability is this package and it is pretty astounding! It resolves addressing and formatting issues completely! And it was just updated and tested last month!

ACS Documentation




回答2:


tidycensus has been treating me nice. The get_acs function gets both the data and geometry.

vt <- get_acs(geography = "county", 
              variables = c(medincome = "B19013_001"), 
              state = "VT",geometry = TRUE)


来源:https://stackoverflow.com/questions/34326603/downloaded-census-data-using-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!