Here's my R code. I utilized the R rgdal package for creating the maps.
This assumes that you've already got your voter data loaded into R.
roads <- readOGR("c:\\data\\poly\\wake_streets\\streets.shp","streets")
roadmap <- spTransform(roads, CRS("+proj=longlat +datum=WGS84"))
county <- readOGR("C:\\data\\poly\\nc_counties\\NC_State_County_Boundary_NAD83HARN.shp",'NC_State_County_Boundary_NAD83HARN')
countymap <- spTransform(county, CRS("+proj=longlat +datum=WGS84"))
plot(roadmap[roadmap$CLASSNAME == 'INT',],col='black',border='black', lwd=.5,axes=F,xlim=c(-79,-78.2),ylim=c(35.5,36.1))
plot(countymap[countymap$County == 'Wake',], add=T)
plot(roadmap[roadmap$CLASSNAME == 'USHWY',],col='black',border='black', lwd=.5, add=T)
points(vtx[vtx$party == 'REP','lng'],vtx[vtx$party == 'REP','lat'],col = rgb(255,0,0,50,maxColorValue=255),cex=.2,pch=20)
points(vtx[vtx$party == 'DEM','lng'],vtx[vtx$party == 'DEM','lat'],col = rgb(0,0,255,50,maxColorValue=255),cex=.2,pch=20)
title("Registered Wake County Republican or Democrats \n (sample of 35,000) - Oct 2013")
My data was collected from the following sources:
Voter registration information from the NC Board of Elections: ftp://www.app.sboe.state.nc.us/
Mapping shapefiles from Wake county: http://www.wakegov.com/gis/services/pages/data.aspx
Geocoding the addresses was done by Texas A&M's Geoservices: http://geoservices.tamu.edu/
1 comment:
I would like to thank Ultimate Life Clinic for reversing my father's Amyotrophic Lateral Sclerosis (ALS). My father’s ALS condition was fast deteriorating before he started on the ALS Herbal medicine treatment from Ultimate Life Clinic. He was on the treatment for just 6 months and we never thought my father will recover so soon. He has gained some weight in the past months and he is able to walk with no support. You can reach them through there website www.ultimatelifeclinic.com
Post a Comment