choroplethr provides native support for creating choropleths from US Census data. This functionality is available with the choroplethr_acs
function (?choroplethr_acs
). The data which choroplethr supports comes from The American Community Survey (ACS). To get a feel for this data you might want to view a list of questions asked on it.
choroplethr does not store any data locally. Rather, it uses the R acs package to get ACS data via the Census API. This means a few things for users of choroplethr
library(acs); api.key.install('<your census api key>');
You will have access to the latest data as soon as it becomes available.
You only have access to data from 2010 onwards, because the Census Bureau does not provide historic data via its API.
Learn about the difference between the 1, 3 and 5 year estimates.
Select a survey to visualize.
Select a table to visualize. When you click thru to a particular survey, you will likely be surprised at just how much data is available. Here are some popular tables to gets you started:
Here is how to view population estimates for each state from the 2012 5-year ACS. Notice that the title is automatically created for you from the name of the table. Note that it is commented out because CRAN's servers do not have a US Census API key installed.
# choroplethr_acs("B01003", "state", endyear=2012, span=5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.