Variables

I am interested in if there is a diffeence in how politically active/participatory Democrats and Republicans are. I used the pid3_2019 variable, filtered to only Democrats and Republicans, to see which party each individual is. I also selected votereg_2019 to see whether or not someone had registered to vote, turnout18post_2019 to see whether or not individuals had voted in the most recent general election, rsmart_P2018_party_2019 to see whether or not someone had voted in the most recent primaries, newsint_2019 to gauge how often individuals keep up with political news, and Democrats_2019 and Republicans_2019, feeling thermometers to see how individuals feels about people from either party.

library(readr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
voterdata19<-read.csv("/Users/Nazija/Desktop/airdrop/Voter Data 2019.csv")

Recoding and Filtering

data <- (voterdata19)%>%
  mutate(Party = ifelse(pid3_2019 == 1, "Democrat",
                 ifelse(pid3_2019 == 2, "Republican",NA)),
         Reg2019 = ifelse(votereg_2019 == 1, "Registered",
                   ifelse(votereg_2019 == 2, "Not Registered", NA)),
         Voted2018 = ifelse(turnout18post_2019 == 1, "Yes",
                     ifelse(turnout18post_2019 == 2, "No",NA)),
         Prim2018Party = ifelse(tsmart_P2018_party_2019 == 1, "Democratic",
                         ifelse(tsmart_P2018_party_2019 == 2, "Republican",
                         ifelse(tsmart_P2018_party_2019 == 98, "Did not vote",
                         ifelse(tsmart_P2018_party_2019 == 99, "Did not vote", NA)))),
         PoliticalInterest = ifelse(newsint_2019 == 1, "Most of the time",
                             ifelse(newsint_2019 == 2, "Some of the time",
                             ifelse(newsint_2019 == 3, "Only now and then",
                             ifelse(newsint_2019 == 4, "Hardly at all", NA)))),
         ft_Dems = ifelse(Democrats_2019 > 100, NA, Democrats_2019),
         ft_Reps = ifelse(Republicans_2019 > 100, NA, Republicans_2019))%>%
  select(Party, Reg2019, Voted2018, Prim2018Party, PoliticalInterest, ft_Dems, ft_Reps)

data = na.omit(data)
head(data)
##         Party    Reg2019 Voted2018 Prim2018Party PoliticalInterest ft_Dems
## 5  Republican Registered       Yes  Did not vote  Most of the time      31
## 7    Democrat Registered       Yes  Did not vote  Most of the time      53
## 10   Democrat Registered       Yes  Did not vote  Most of the time      97
## 14   Democrat Registered       Yes  Did not vote  Most of the time      95
## 17   Democrat Registered       Yes  Did not vote  Most of the time      73
## 18 Republican Registered       Yes    Republican  Some of the time       0
##    ft_Reps
## 5       74
## 7        5
## 10       0
## 14       0
## 17       1
## 18      52