Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SantoshSrinivas79/f2114a13832946398b9a to your computer and use it in GitHub Desktop.
Save SantoshSrinivas79/f2114a13832946398b9a to your computer and use it in GitHub Desktop.
Visualizing state date buried in a PDF

Visualizing state date buried in a PDF

I recently came across a common problem of visualizing simple state level data captured in PDFs as a choropleth. The data is from an significantly well researched report on housing data

tabulapdf/tabula works quite well in extracting data. Yeah! Even on a windows machine!

Now, that we have got the data, let us create the state choropleth.

Making basic state level Choropleths is a breeze CRAN - Package choroplethr available at arilamstein/choroplethr

Let us create a static version of the map like it is available at Out Of Reach: National Low Income Housing Coalition.

sDir <- "~/Dropbox/pandora/My-Projects/repos/hackery/"
setwd(sDir)

library(choroplethr)
library(choroplethrMaps)
data(state.regions)
head(state.regions)

Now, the data in state.regions does not match exactly with the dataset we have at hand.

So, instead of correcting the data so that it matches manually, let us try to use a algorithmic approach.

The R packages that seem to be available to accomplish this task are:

Replacing the data worked quite well with gsub explained at http://biostat.mc.vanderbilt.edu/wiki/pub/Main/SvetlanaEdenRFiles/regExprTalk.pdf

To Do

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment