37831

Downloaded Census Data using R

Question:

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

<a href="http://factfinder.census.gov/faces/tableservices/jsf/pages/productview.xhtml?src=CF" rel="nofollow">http://factfinder.census.gov/faces/tableservices/jsf/pages/productview.xhtml?src=CF</a>

but have not had success with the following code:

<blockquote>

library(RCurl)

step1 = "<a href="http://factfinder.census.gov/faces/tableservices/jsf/pages/productview.xhtml?src=CF" rel="nofollow">http://factfinder.census.gov/faces/tableservices/jsf/pages/productview.xhtml?src=CF</a>"

step2 = getURL(step1)

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

</blockquote>

Any thoughts would be greatly appreciated!

Answer1:

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!

<a href="https://cran.r-project.org/web/packages/acs/acs.pdf" rel="nofollow">ACS Documentation</a>

Answer2:

<a href="https://walkerke.github.io/tidycensus/articles/basic-usage.html" rel="nofollow">tidycensus</a> 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)

Recommend

  • How to configure mentioned use case using spring batch parallel step split flow?
  • reusing snap.svg loaded svg into different elements
  • How can I check if the user have correctly submitted the previous form into a Spring MVC application
  • Request joining the results of two other requests with GROUP BY clause in SQL Server 2005
  • R: Replacing a factor with an integer value in numerous cells across numerous columns
  • How to execute in first a function and in second canActivate()
  • How can I get the url from an ng-resource?
  • Why doesn't copyTo(… PASTE_VALUES) work in the middle of a macro?
  • How to know the return address of a function?
  • Getting Unsupported AMF version error while using AMF Connection to send flex message
  • ggplot2 ggsave function causes graphics device to not display plots
  • Optimizing Google Sheets .appendRow()
  • How to pass props to react component through routing using react-router?
  • Use Excel VBA to change Powerpivot connection to csv file
  • Convert data type in R or Python
  • How to save dynamically created textboxes and their values
  • Adding independent aspx/asmx pages into DotNetNuke
  • Merge Module leaving files during uninstall
  • xtable - background colour of added rows
  • HttpURLConnection.getOutputStream() takes 20 seconds. Why?
  • pip in virtualenv gets ConnectTimeoutError
  • Find group of records that match multiple values
  • Center align outputs in ipython notebook
  • How do I signal completion of my dataflow?
  • Run multiple queries from 1 SQL file showing result in multiple tables
  • saving file generated by TCPDF
  • How to view images from protected folder with php?
  • Installed module is empty
  • Textfile Structure (tables)
  • How would I use PHP exceptions to define a redirect?
  • vba code to select only visible cells in specific column except heading
  • InvalidAuthenticityToken between subdomains when logging in with Rails app
  • SQL merge duplicate rows and join values that are different
  • LevelDB C iterator
  • Bitwise OR returns boolean when one of operands is nil
  • Can't mass-assign protected attributes when import data from csv file
  • sending mail using smtp is too slow
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs
  • Converting MP3 duration time