问题
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