Mapping MA election results

January 25, 2010

[This article was first published on Offensive Politics, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The Swing State Project recently had some very interesting maps comparing last week’s election results from Massachusetts to 2008 presidential primary results. Their maps posted show some very interesting trends, but the maps themselves are lacking in information and the color schemes are pretty ugly. Using my own source data I recreated their election night maps, along with a few more. The geography was taken directly from the US Census so some of the waterlines are pretty strange compared to other result maps like the Boston Globe and Swing State Project.

First look at the results from the MA 2010 Senate special election.

MA Senate 2010 Results

MA Senate 2010 Results

Now compare that to the results of the 2008 presidential primary in MA, blue gradients for Obama and red gradients for Clinton.

Democrat 2008 Presidential Primary results

Democrat 2008 Presidential Primary results

Using the same color scale and data cut-points we can see the same results that DavidNYC came up with, namely that winning townships for Clinton in 2008 tracked decently to winning townships for Scott Brown in the 2010 Senate race.

Obama lost the MA presidential primary in 2008, but he won in the general. Here is a map showing the vote margins from the 2008 presidential general:

MA 2008 Presidential results

MA 2008 Presidential results

Compared to the MA 2010 Senate race last week these 2008 numbers are astounding. The democratic vote margin in 2008 was 26 points (62% to 36%), while the 2010 senate race was -5 points (47-52), with 30% less turnout in 2010 than in 2008. I decided to create another map showing the decline in democratic vote support

Democratic vote change 2010 to 2008

Democratic vote change 2010 to 2008

Does this mean voters have turned against democrats in MA? Maybe, but it is interesting that Scott Brown got more votes in the special election (1,168,107) as McCain did in the 2008 general (1,108,854), even though 900,000 less people voted in the special. So Brown was able to do two things: 1) Activate republican McCain voters, 2) Cause democrats to cross party lines. I don’t think this spells certain doom for congressional democrats in the midterms, but it does show that Democrats will stay home on election day, even in a historically democratic state, for the wrong candidate.

You can create the maps yourself or play with the data by downloading the source + data files here. With a recent installation of R you can recreate the maps above by running the the following command:



To leave a comment for the author, please follow the link and comment on their blog: Offensive Politics. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , ,

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)