Overview

This article from FiveThirtyEight explores reasons that many Americans choose not to vote in elections. The reasons include: * They feel their vote doesn’t matter. * They feel voting isn’t worth their time. * They don’t have the time because of their job. * They feel intimated by the voting process. * Neither candidate is appealing to them.

Some Americans vote inconsistently. They may choose to vote when they feel like their vote has a chance to make a difference. Also, pandemic-related situations, such as Republicans feeling as though former President Trump didn’t have an adequate response to COVID-19, had made him an unappealing choice. And since President Biden is a Democrat, staunch red voters were against him. This resulted in some Americans not casting a vote at all.

Load necessary libraries

library(ggplot2)

Load the data into a data frame.

Rename the columns to be more readable.

filename <- "https://raw.githubusercontent.com/djunga/voting-americans/main/nonvoters_data.csv"

responses <- read.csv(filename, header=TRUE, sep=",")


#1. subset of columns
responses <- subset(responses, select =c(Q1,Q7,Q22,Q24,Q30,ppage,gender,educ,race,income_cat,
                                         voter_category))

# make column names meaningful
colnames(responses) <- c("is_us_citizen", "want_govt_changes", "reason_not_registered",
                         "preferred_voting_method", "party_alignment", "age","gender",
                         "edu_level", "race", "income_category", "vote_frequency") 
  
View(responses)

Data cleaning

Replace the values in each column with more readable values.

df <- responses

df$is_us_citizen[df$is_us_citizen==1] <- 'yes'
df$is_us_citizen[df$is_us_citizen==2] <- 'no'

df$want_govt_changes[df$want_govt_changes==1] <- 'a lot'
df$want_govt_changes[df$want_govt_changes==2] <- 'not really needed'

# better not to change the values for reason_not_registered
df$reason_not_registered[df$reason_not_registered==1] <- 'I don\'t have time to register or vote'
df$reason_not_registered[df$reason_not_registered==2] <- 'I don\'t trust the political system to serve my needs'
df$reason_not_registered[df$reason_not_registered==3] <- 'I don\'t know how to register'
df$reason_not_registered[df$reason_not_registered==4] <- 'I don\'t want to register'
df$reason_not_registered[df$reason_not_registered==5] <- 'I am not eligible to vote'
df$reason_not_registered[df$reason_not_registered==6] <- 'I don\'t think my vote matters.'
df$reason_not_registered[df$reason_not_registered==7] <- 'Other'
# Also, replace the NA with 'NA, I am registered.'
df$reason_not_registered[is.na(df$reason_not_registered)] <- 'NA, I am registered'

df$preferred_voting_method[df$preferred_voting_method==1] <- 'Mail-in or absentee ballot'
df$preferred_voting_method[df$preferred_voting_method==2] <- 'In-person before Election Day'
df$preferred_voting_method[df$preferred_voting_method==3] <- 'In-person on Election Day'
df$preferred_voting_method[df$preferred_voting_method==4] <- 'Other' 

df$party_alignment[df$party_alignment==1] <- 'Republican'
df$party_alignment[df$party_alignment==2] <- 'Democrat'
df$party_alignment[df$party_alignment==3] <- 'Independent'
df$party_alignment[df$party_alignment==4] <- 'Another party'
df$party_alignment[df$party_alignment==5] <- 'No preference'

Addressing invalid values.

We can see that these columns have some invalid values, like -1. Remove them.

# We can see that these columns have some invalid values.
unique(df$is_us_citizen)
## [1] "yes"
unique(df$want_govt_changes)
## [1] "a lot"             "not really needed" "-1"
unique(df$reason_not_registered)
## [1] "NA, I am registered"                                 
## [2] "Other"                                               
## [3] "I don't think my vote matters."                      
## [4] "I don't trust the political system to serve my needs"
## [5] "-1"                                                  
## [6] "I don't have time to register or vote"               
## [7] "I don't want to register"                            
## [8] "I am not eligible to vote"                           
## [9] "I don't know how to register"
unique(df$preferred_voting_method)
## [1] "Mail-in or absentee ballot"    "In-person on Election Day"    
## [3] "Other"                         "In-person before Election Day"
## [5] "-1"
unique(df$party_alignment)
## [1] "Democrat"      "Independent"   "Republican"    "No preference"
## [5] "Another party" "-1"
# Remove the invalid values
df<-df[!(df$want_govt_changes==-1 | 
          df$party_alignment==-1 |
          df$is_us_citizen==-1 |
          df$reason_not_registered==-1 |
          df$preferred_voting_method==-1)
          ,]

View(df)

Visualizations

Bar graph depicting the preferred voting method among Black, Hispanic, Other/Mixed, and White Americans.

ggplot(data = df) + 
  geom_bar(mapping = aes(x = race, fill = preferred_voting_method, color=preferred_voting_method),
           alpha=0.3, position = "dodge")

The graph shows that each race group except for white prefers to vote by mail-in or absentee ballot the most. Also, there appears to be a significant difference between the ratio of the “in-person before election day” voting method and the rest of the methods for white Americans compared to the other race groups.

Stat summary depicting ages of Americans by party alignment.

ggplot(data = df) + 
  stat_summary(
    mapping = aes(x = party_alignment, y = age),
    fun.min = min,
    fun.max = max,
    fun = median
  )

The “Another party” alignment has the lowest median age, followed by “no preference”. This may suggest that younger Americans are gravitating away from the traditional parties. The Democrat, Republican, and Independent have nearly the same median age, between 55 and 60.

Stacked bar graph depicting the proportions of unregistered Americans whether they believe the government needs changes versus the reason they’re not registered.

df1 <-subset(df,reason_not_registered!='NA, I am registered')
View(df1)

ggplot(data = df1) + 
  geom_bar(mapping = aes(x = want_govt_changes, fill = reason_not_registered), position = "fill")

I believe the left column is the more interesting of the two. The two most common reasons that Americans who believe the government needs a lot of changes are: they don’t want to register, and they don’t think their vote matters. Also, about 20% of these Americans don’t think their vote matters.

Conclusion

This article was based on a poll from prior to the 2020 presidential election, when many people believed the stakes were especially high. Perhaps now, 1 year into Biden’s presidency, it would be interesting to do another poll. Did Americans’ views on voting change at all? If they didn’t vote in the election, do they now regret their choice?