The class will teach you how to turn publicly available Census, campaign finance and voter data into compelling, insightful news about the 2024 election. Along the way, you’ll gain coding, graphing and mapping skills that will make you a valuable addition to any news or PR operation.
For example: How could you determine where in Rutherford County - which generally votes Republican - Democratic candidates are likely find the most support during the 2024 general election? This map can give you an idea:
The map shows precinct-level vote totals for Republican incumbent Bill Lee and Democratic challenger Jason Martin during the Tennessee governor’s race in 2022.
The closer to blue a precinct is, the greater the percentage of votes for Martin, the Democrat.
Mouse over a precinct to see the percent of votes for Lee, the Republican.
Click a precinct to see vote tallies.
Zoom in to look at geographic details.
Martin lost to Lee countywide, as he did statewide. But in the precincts around MTSU, Martin won. And he came close to besting Lee in several precincts in the Smyrna and LaVergne areas toward the Metro Nashville/Davidson County line.
That’s important information, both for Republicans wanting to shore up support in 2024 and for Democrats looking to find openings and opportunities.
I made the map using data from the Tennessee Secretary of State’s web site, a digital precinct map file from the Rutherford Planning Commission’s web site, and R, a free, open-source coding language used by journalists and data scientists all over the world. R syntax is relatively easy to understand compared to the syntax of other programming languages, and the web offers countless “how to” videos and tutorials about R.
This R code merged the data and map files, calculated the percentage of votes for Lee within each precinct, deleted any unneeded data columns, and made the map:
# Reading the data files into R
Precincts <- st_read("Precinct_Hub_Data.shp")
GovResults <- read.csv("GovResults.csv")
# Merging the data files
Map <- left_join(Precincts, GovResults,
by = join_by(Precinct == Precinct))
# Calculating percentage of votes for Lee
Map <- Map %>%
mutate(Lee_Pct = format(round((Lee / (
Lee + Martin
)),
digits = 2), nsmall = 2))
Map <- Map %>%
select(c("Precinct",
"Race",
"Lee",
"Martin",
"Lee_Pct",
"geometry"))
# Making the map
Map <- st_as_sf(Map)
FinalMap <- mapview(
Map,
zcol = "Lee_Pct",
layer.name = "Pct. for Lee",
popup = popupTable(
Map,
feature.id = FALSE,
row.numbers = FALSE,
zcol = c("Precinct",
"Race",
"Lee",
"Martin")))
Well, it’s not exactly easy. But I will make it easy for you to learn, or at least easier than you’re probably thinking it would be.
For example, the class will never require you to write a script like the one above, start to finish, from scratch. Instead, I’ll give you the whole script at the outset. All you have to know how to do is edit a few of the script’s lines to get it to do exactly what you want.
Once you know how to do that, you can use the script to map any set of voting results you like, as long as you can get your hands on the data and map file needed. That’s a powerful skill. It’s a marketable one, too.
I couldn’t, either. I’ve been coding for around five years, and I still can’t do much purely from memory. Instead, I keep a stash of scripts I’ve already written. When I need to do something with code, I look through the stash for a script I can tweak to get the job done. If I can’t find what I need, I can look through code stashes that thousands of other R coders around the world have put online, typically with explanations of what the code does and how it works. R coders help one another. Google “R tutorial,” and you’ll see what I mean.
Class assessments will mirror this spirit of openness and collaboration. There will be no timed, memory-based, and otherwise hairy, scary exams. You’ll earn credit by showing up to class, participating in what happens there, and completing small, weekly, open-book, open-note coding projects, always with me nearby to help. Collaboration among course students is not only OK, but encouraged. There will be no “group projects,” however. I dislike those. I’ll bet you do, too.
We’ll start by learning how to install, set up and run both R and its companion code-editing application, RStudio. Next, we’ll learn some basic “data wrangling” with R - things like how to import, filter, and sort data, so that you can pare a big dataset down to just the data you need.
After that, we’ll start looking at voting data from past elections, current campaign contribution records from the U.S. Federal Election Commission data, and other datasets that might give us insights into how the November 2024 election might play out here in the Nashville-Murfreesboro-Franklin area. On election night, we’ll help the Middle Tennessee News and Sidelines student media operations cover live election results using real-time data from The Associated Press. We’ll wrap up with some post-election data analysis aimed at explaining the election’s outcome.
I know. Most media students are. I used to be as well. But this is not a math class. If you understand what a percentage is and what an average is, you’ll be fine.
When there’s calculating to be done, R will happily do it for you. Your job will be to learn how to get R to do the calculations and how to interpret the results R gives you. No prior coding or data analysis experience will be needed.
Come on. Sign up. You can do this. Thirty-some years ago, I was a cub newspaper reporter who went to a training seminar that taught me how to use a spreadsheet. At the time, spreadsheets were cutting-edge technology. That half-day seminar changed the course of my entire career. Taking this class might change yours.
Election Analytics | CRN 86568 | JOUR 3520.001 | Dr. Ken Blake