[This article was first published on data science ish, 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.
Well, it’s been an interesting election season so far, right? Everybody holding up OK? Utah held its caucuses this past Tuesday on March 22 and I thought I would do a bit of plotting to show the results. We can get the JSON data from CNN, as pointed out by Bob Rudis in his post here. Utah’s results were not available when he wrote that post but I was able to poke around and find them using the guidance he provided there. Many thanks to CNN for all the hard work they do in reporting!
Every county in Utah was won by the same Republican or Democratic candidate, so it will not be particularly interesting to make maps showing who won the caucuses. Instead, what I’m going for here is to see if there are any differences in voting patterns for the various candidates. To do that, let’s make a data frame for each candidate with his/her results. First up, the Republicans.
This was my first time to use purrr, Hadley Wickham’s library which is sort of similar to dplyr but for functions. I am a HUGE fan of dplyr and it is very soothing and makes me happy, so I am looking forward to getting used to purrr and using it more. Let’s do the Democratic candidates now.
For plotting, I am going to use Ari Lamstein’s choroplethr package which needs the data in wide format. Let’s start getting that set up, first with the Republicans.
Now for the Democrats.
What do these data frames look like?
Now, Some Plots!
Before we look at any plots, I’d like to tell/remind everyone that the population in Utah is not evenly distributed. I’ve done some demographic mapping for Utah in a previous blog post, but just as a reminder, Salt Lake County (where I live) has a population over 1 million and the rest of the counties have much lower populations. Utah County, just to the south of Salt Lake, has a population that is about half of Salt Lake’s and the numbers drop off precipitously after that. There are a number of very rural counties with populations in the 1000s. Utah’s Republican caucus has a rule where if someone gets more than 50% of the vote, then a winner-takes-all rule kicks in for delegates. Utah’s Democratic caucus does not have a similar rule; it chooses some delegates based on the overall statewide vote and some based on votes in the four congressional districts.
SO! Let’s do this.
Ted Cruz won the Republican caucus in all counties, handily in almost all of them. They seem to quite like John Kasich over there in Park City and Summit County. Trump did better (but did not win) in some extremely rural counties: Piute, Grand, and Daggett. I don’t want to fall into the trap of just telling a sensible-sounding story for what happened, but Republicans here in Utah are very establishment-type Republicans and it makes sense that Trump’s appeal is not strong. Also, as Nate Silver pointed out in a different context (whether Utah might go for Hillary Clinton vs. Trump), the authoritarian populism of Trump is unappealing in many ways to a religious minority such as Mormons.
OK, let’s look at the Democratic race.
Bernie Sanders did extremely well in most counties in Utah, even better than he was expected to. There are a couple of counties where zero people voted for any Democratic candidate, though. There was record turnout for the caucuses this year (I have heard this especially in the context of the Democratic caucuses) but let’s look at this in the context of comparing the caucuses; how many people voted for either a Republication or a Democratic candidate?
That is quite a difference. The number of Republican voters in the caucus was this much higher despite the fact that you have to be a registered Republican to vote in that caucus while the Democratic caucus was open to registered Independents and unaffiliated voters.
As the caucus was approaching and preparations were being made, I kept thinking, “Why don’t I remember voting in a caucus before?!” I have always lived in primary states previously, but I did live here in Utah during the last presidential election. Politics is not one of my top life passions, but I almost always manage to muster the energy to go vote. A passing remark by a friend led me to do some research and then realize that Utah was not a caucus state the last time around. Since the last presidential election, Utah has switched from a primary system (run by the state government) to a caucus system (run by the political parties). The Utah Republican Party wanted to do this while the Utah Democratic Party did not; I leave it to you to infer from the last plot how successful state Democratic politicians are at achieving such goals. The Utah Republican Party set up a caucus with an option of voting online, while the Utah Democratic Party went with paper ballots (literally, 8.5×11 copied sheets of paper). There is a big difference in available resources between the parties here. The turnout was unexpectedly high at the Democratic caucuses; they were expecting about 65,000 voters and almost 80,000 voters came to caucus. There were long lines winding around the blocks, locations running out of ballots and having to copy more, and lots of waiting. I haven’t heard of many voters from these caucuses being angry, though; there seemed to be a sense of camaraderie and excitement. The R Markdown file used to make this blog post is available here. I am very happy to hear feedback or questions!
To leave a comment for the author, please follow the link and comment on their blog: data science ish.