He Knows If You’ve Been Voting

In 2020, I volunteered to write letters for VoteFwd. The idea behind it is that receiving a letter from someone in the leadup to an election can motivate reluctant voters to show up at the polls. Since voting is vital for our democracy to function, I joined numerous other activists in writing such letters, signing up for 20 letters each in Texas and North Carolina. I wrote my letters and sent them off as part of the big send, but I was wondering, did I have an impact?

40 letters was not too large of a number, but it was bordering on the point that some scripting would help me get to the bottom of my question. Each letter that I wrote had a PDF template that was printable that included the individual addresses (though I fully handwrote the actual letters, sorry I though the template was a little tacky). I then took all of the pdfs template for the voters I had written to, saved them in a folder, and wrote an R script to create a csv of the addresses (see code below).

The script produced a nice csv file with most of the information I needed so I imported them into my google contacts. I also labeled them so I could easily find these 40 contacts. Had I known, I would have added a phone number and removed the middle names for each contact as well so I recommend doing this to the csv at this point – more on this later.

The next step was to actually look up whether my folks voted. The reason why I imported the addresses into google contacts is because I wanted to use the phone app Impactive. This app allows you to look up which friends of yours regularly vote or not, and is especially easy to use if you have their addresses in your contacts since it hits voter files. In order to get the contacts to show up though, it was also necessary to have their phone numbers, which is why I added phone numbers after the fact. Since I didn’t actually have the 40 voters’ numbers I just picked a random number with Texas and North Carolina area codes.

And then I waited (March 2021). And waited (June 2021). And waited (September 2021). And waited (December 2021). And waited (February 2022). See it apparently takes a while for the voter file to update. I usually checked myself first before looking for my 40 voters since I know that I voted in 2020.

Finally, I checked on May 7, 2022 using Impactive to see if I voted, and I found out that I had voted in 2020, so I knew it was time to check my 40 voters. This is when I discovered that including the middle names made it harder to find the voters (I hypothesized that it was going to make it easier, but all of the middle names had to be deleted to get Impactive to work). And here are the results.

State Voted? Found? Percent Voted
NC 7 17 41%
TX 11 17 65%
Grand Total 18 34 53%

Unfortunately, I couldn’t find everyone. Some people didn’t show up, perhaps because they had moved, and some had common names and lived in a large city so I couldn’t make out which person was the one that had potentially gotten my letter. I did count one person though, since they had a common name, but all of the folks with the common name voted so I am sure one of them got my letter.

It did appear that I had could have had an impact. Obviously, it is a small sample size and I don’t have a counterfactual, but overall 53% of the 40 voters that I could find voted. This definitely made me think I should sign up for VoteFwd again in 2022 (you can too – https://votefwd.org/campaigns) and write more letters so I have a bigger sample size. I might try to do some with a template too to see if they is more or less effective (it certainly is quicker to use the template).  

RScript

library(dplyr)
library(pdftools)

filenames <- list.files(“/filepath/VoteForward Complete”, pattern=”*.pdf”, full.names=TRUE)
addresses <- data.frame(matrix(ncol = 6, nrow = 0))
colnames(addresses) <- c(“First Name”, “Last Name”, “Street Address”, “City”, “State”, “Zip”)

for(f in filenames) {
 letter_pdf <- pdf_data(f)[[1]]
 letter_text <- as.data.frame(arrange(letter_pdf,y, x)$text)
 i <- 0
 step <- 0
 first_name <- ”
 last_name <- ”
 street <- ”
 city <- ”
 state <- ”
 zip <- ”

 while(i < nrow(letter_text)) {
  i <- i+1
  current_row <- as.character(letter_text[i,])

  if(step == 3) {
   if(substr(current_row, nchar(current_row), nchar(current_row)) == “,”) {
    step <- 0
    city <- paste(city, substr(current_row, 1, nchar(current_row)-1))
    current_row <- as.character(letter_text[i+1,])
    state <- current_row
    current_row <- as.character(letter_text[i+2,])
    zip <- current_row
    addresses <- rbind(addresses,
              data.frame(`First.Name` = first_name, `Last.Name` = last_name, `Street.Address` = street, City = city, State = state, Zip = zip))
   } else {
    city <- ifelse(city == ”, current_row, paste(city, current_row))
   }
  }

  if(step == 2) {
   if(substr(current_row, nchar(current_row), nchar(current_row)) == “,”) {
    step <- 3
    street <- paste(street, substr(current_row, 1, nchar(current_row)-1))
   } else {
    street <- ifelse(street == ”, current_row, paste(street, current_row))
   }
  }

  if(step == 1) {
   if(substr(current_row, nchar(current_row), nchar(current_row)) == “,”) {
    step <- 2
    last_name <- substr(current_row, 1, nchar(current_row)-1)
   } else {
    first_name <- ifelse(first_name == ”, current_row, paste(first_name, current_row))
   }
  }
  if(as.character(letter_text[i,]) == “voting.” & as.character(letter_text[i+1,]) == “For:”) {
   i <- i+1
   step <- 1
  }
 }
}
write.csv(addresses, “Addresses.csv”)

Development of a Fuel Economy Based Vehicle Excise Tax in the District of Columbia

Development of a Fuel Economy Based Vehicle Excise Tax in the District of Columbia
2nd Annual Transportation, Air Quality, and Health Symposium – CARTEEH
May 18, 2021
A presentation given to the 2nd Annual Transportation, Air Quality, and Health Symposium – CARTEEH on a project I completed in R.

View the Presentation

Add Birthday Song to Google Contacts R Script

One of my favorite music columns of the past several years is The Number Ones on Stereogum.  The column is reviewing every single Billboard Hot 100 Number of Hit of all time.  I was looking through my contacts and thought it would be nice to know what someone’s #1 Birthday Song was, because that is the type of person I am (mine was Blondie’s “Call Me” – Tom Breihan gave it a 10/10). 

I thought it would be interesting to have that available for my friends and other network folks,  but I would never want to manually add that information.  So using rvest, I threw together a script that takes a csv downloaded from google contacts, finds every entry with a complete birth date (month, date, and year), and adds a custom field with the song’s name and title.  This data is then exported to a new csv. 

One then needs to make a minor edit to the header so that it looks like the next image (the single “.”s need to be replaced with a ” ” and a the “…”s need to be replaced with a ” – “).  Then the file can be re-imported into google contacts.  You then need to run “merge and fix” on all of these “new” contacts and voila you now can tell your friends what their #1 Birthday Song is.

The script is available here.