I am trying to make a choropleth of very simple data, and it's kind of a pain in the neck. I have the following zip codes in the Eastern USA. This is made up data but you get the idea.
Zip Freq
11101 10
10014 15
11238 400
etc. for about 100 rows. Values of Freq range from 0-1000, and these are the ones I would like to use to determine the color of each zipcode. I would ideally also like the map to focus on the Eastern USA instead of the whole country.
I want to make a choropleth with this data and each zip code but I can't figure out how to import zip code shapefiles. I have tried this tutorial but I got an error at the fortify() step that I can't get beyond. I'm not sure if that tutorial's method is even the best way to go about it.
ggplot2 seems to come with State and County, but I can't figure out how to map by zip code. (Eventually I am going to map by census tract but right now I just want to learn how to use shapefiles for zip codes and this simple data set)
All the resources I have found for choroplethr use functions that are now deprecated. I spent hours chasing my tail in an effort to use it, and am so frustrated, so any help would be greatly appreciated.
# install.packages("devtools") library(devtools) install_github('arilamstein/[email protected]')
? it's not on cran. – HoopesgpclibPermitStatus
issue. ThechoroplethZip
package is safe to use and is probably the easiest way for you to do what you need to do unless you want an end-to-end example on doing it manually inggplot
(from shapefile to choropleth). – Shandrainstall.packages("gpclib", type="source")
. Just grab RTools if you're on Windows. – Shandra