getCensus
Below we will collect census data for the US cities of Chicago and New York. Our radius will be the boundary around the coordinates of the city and the getCensus
function will output the census data for each city within the given boundary.
library(census) # City level data for Chicago and New York radius <- 5 cities <- c("Chicago, IL", "New York") df <- getCensus(cities, radius) df[1:2, c("sitename","radius","TotPop","pctMales","pctFemales","AvgFamInc","pctPrivWageWorkers","pctGovWorkers", "pctMarried","pctBachelors","MedianHValue")]
Note that fields like AvgFamInc and MedianHValue are by default characters with commas. These fields need to be properly converted into numeric values if further analysis is going to be done.
This product uses the Google Maps API and collects data from the Missouri Census Data Center, but is not endorsed or certified by Google or the Missouri Census Data Center.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.