I always wondered how people created beautiful geospatial visualizations in R. I would stare googly-eyed at the perfect gradients which could make a dashboard or presentation pop, wondering just how the hell people were doing this in the programming language I associated with p-values and regression lines.
Surprisingly, you can actually accomplish this with but a few lines of code — I’m here today to show you how.
Step 1: Access the American Community Survey (“acs”) API
First, you’ll need access to the Census Bureau’s API. Go to this link to request an API key. After about 10 seconds you should get an email with your key and a link to confirm you are, indeed, human. Stash your API key somewhere — you’ll need to call it every time you reopen R.
In order for the API to be read correctly, we’ll need to install 3 libraries: “acs”, “choroplethr”, and “choroplethrMaps”. We’ll also install “RColorBrewer” and “ggplot2” for graphing later on.
A choropleth map (from Greek χῶρος “area/region” and πλῆθος “multitude”) is a type of thematic map in which areas are shaded or patterned in proportion to a statistical variable that represents an aggregate summary of a geographic characteristic within each area, such as population density or per-capita income.— Wikipedia

#data-science #rstudio #programming #geospatial #visualization

Mapping Geospatial Data in R
1.15 GEEK