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
library(readr)
Vote <- read_csv("~/Downloads/Vote.csv")
## Parsed with column specification:
## cols(
##   .default = col_character(),
##   NumChildren = col_double(),
##   Immigr_Economy_GiveTake = col_double(),
##   ft_fem_2017 = col_double(),
##   ft_immig_2017 = col_double(),
##   ft_police_2017 = col_double(),
##   ft_dem_2017 = col_double(),
##   ft_rep_2017 = col_double(),
##   ft_evang_2017 = col_double(),
##   ft_muslim_2017 = col_double(),
##   ft_jew_2017 = col_double(),
##   ft_christ_2017 = col_double(),
##   ft_gays_2017 = col_double(),
##   ft_unions_2017 = col_double(),
##   ft_altright_2017 = col_double(),
##   ft_black_2017 = col_double(),
##   ft_white_2017 = col_double(),
##   ft_hisp_2017 = col_double()
## )
## See spec(...) for full column specifications.
View(Vote)
head(Vote)
## # A tibble: 6 x 53
##   gender race  education familyincome children region urbancity Vote2012
##   <chr>  <chr> <chr>     <chr>        <chr>    <chr>  <chr>     <chr>   
## 1 Female White 4-year    Prefer not … No       West   Suburb    Barack …
## 2 Female White Some Col… $60K-$69,999 No       West   Rural Ar… Mitt Ro…
## 3 Male   White High Sch… $50K-$59,999 No       Midwe… City      Mitt Ro…
## 4 Male   White Some Col… $70K-$79,999 No       South  City      Barack …
## 5 Male   White 4-year    $40K-$49,999 No       South  Suburb    Mitt Ro…
## 6 Female White 2-year    $30K-$39,999 No       West   Suburb    Barack …
## # … with 45 more variables: Vote2016 <chr>, TrumpSanders <chr>,
## #   PartyRegistration <chr>, PartyIdentification <chr>,
## #   PartyIdentification2 <chr>, PartyIdentification3 <chr>,
## #   NewsPublicAffairs <chr>, DemPrimary <chr>, RepPrimary <chr>,
## #   ImmigrantContributions <chr>, ImmigrantNaturalization <chr>,
## #   ImmigrationShouldBe <chr>, Abortion <chr>, GayMarriage <chr>,
## #   DeathPenalty <chr>, DeathPenaltyFreq <chr>, TaxWealthy <chr>,
## #   Healthcare <chr>, GlobWarmExist <chr>, GlobWarmingSerious <chr>,
## #   AffirmativeAction <chr>, Religion <chr>, ReligiousImportance <chr>,
## #   ChurchAttendance <chr>, PrayerFrequency <chr>, NumChildren <dbl>,
## #   areatype <chr>, GunOwnership <chr>, EconomyBetterWorse <chr>,
## #   Immigr_Economy_GiveTake <dbl>, ft_fem_2017 <dbl>, ft_immig_2017 <dbl>,
## #   ft_police_2017 <dbl>, ft_dem_2017 <dbl>, ft_rep_2017 <dbl>,
## #   ft_evang_2017 <dbl>, ft_muslim_2017 <dbl>, ft_jew_2017 <dbl>,
## #   ft_christ_2017 <dbl>, ft_gays_2017 <dbl>, ft_unions_2017 <dbl>,
## #   ft_altright_2017 <dbl>, ft_black_2017 <dbl>, ft_white_2017 <dbl>,
## #   ft_hisp_2017 <dbl>
Vote %>%
  select(PartyIdentification, ft_police_2017) %>%
  filter(PartyIdentification == "Democrat"| PartyIdentification == "Republican") %>%
  group_by(PartyIdentification) %>%
  summarize(AVERAGE = mean(ft_police_2017, na.rm = NA))
## # A tibble: 2 x 2
##   PartyIdentification AVERAGE
##   <chr>                 <dbl>
## 1 Democrat               68.4
## 2 Republican             87.1

#From this, I see out of 100, Democrats rate on average 68 out of 100 for their feelings towards the police. On the other hand, I see that out of 100, Republicans rate on average 87 out of 100 for their feelings towards the police. Republicans had a higher average because they may believe that the police will help maintain society, isolate those who are considered “deviant”, and ensure the protection of the people. On the other hands, Democrats had a lower rate possibly due to the severity of police brutality, especially towards those of certain socioeconomic statuses that have no support, money, and priviledge. In addition, Democrats may think that the policing of society develops systematic problems.

Vote %>%
  select(PartyIdentification, GunOwnership) %>%
  filter(PartyIdentification == "Democrat"| PartyIdentification == "Republican") %>%
  group_by(PartyIdentification, GunOwnership) %>%
  summarize(n=n()) %>%
  mutate(percent=n/sum(n))
## # A tibble: 8 x 4
## # Groups:   PartyIdentification [2]
##   PartyIdentification GunOwnership            n percent
##   <chr>               <chr>               <int>   <dbl>
## 1 Democrat            Dont Know              82 0.0273 
## 2 Democrat            Gun in Household      892 0.297  
## 3 Democrat            No Gun in Household  2014 0.670  
## 4 Democrat            <NA>                   16 0.00533
## 5 Republican          Dont Know             235 0.102  
## 6 Republican          Gun in Household     1092 0.473  
## 7 Republican          No Gun in Household   934 0.404  
## 8 Republican          <NA>                   50 0.0216

#From summarizing the sum of Party Identification for Democrats and Republicans and GunOwnership, I see a major difference between Democrats and Republicans. I see that Democrats lean more on not having guns at 67% and Repubilicans lean more on having gun at 47%. This difference could show how Democrats may feel that guns makes society more vulnerable, split, and fearful. For Republicans, some reasons why they may feel strongly with having guns at home is for defense from danger, protection, and power.

new_Vote <- Vote %>%
  filter(PartyIdentification == "Democrat"| PartyIdentification == "Republican")

table(new_Vote$PartyIdentification, new_Vote$GunOwnership) %>%
  prop.table(1)
##             
##               Dont Know Gun in Household No Gun in Household
##   Democrat   0.02744311       0.29852744          0.67402945
##   Republican 0.10393631       0.48297214          0.41309155

#From this cross-tabulation, I can see that the Democrats’ row dominates “No Gun in Household” at 67%. In addition, Democrats are at 30% for “Gun in Household” and 3% for “Don’t Know”. The results for Democrat’s clearly depicts that they are more against guns.

#For the Republicans’ row, I see they are at 48% for “Gun in Household”, 41% for “No Gun in Household”, and 10% for “Don’t Know”. The results for Republicans are close for “Gun in Household” and “No Gun in Household”. This may show how Republicans may have mixed feelings on guns, whereas Democrats have strong feelings on guns. The Democrats have a higher percentage difference between “Gun in Household” and “No Gun in Household”.

Vote %>%
  select(PartyIdentification, ft_christ_2017) %>%
  filter(PartyIdentification == "Democrat"| PartyIdentification == "Republican") %>%
  group_by(PartyIdentification) %>%
  summarize(AVERAGE = mean(ft_christ_2017, na.rm = NA))
## # A tibble: 2 x 2
##   PartyIdentification AVERAGE
##   <chr>                 <dbl>
## 1 Democrat               63.8
## 2 Republican             85.4

#From this, I see how out of 100, Democrats rate on average 64 for their feelings on religion. On the other hand, I see how out of 100, Republicans rate on average 85 for their feelings on religion. The results show Democrats may feel that religion is something that should not be expressed in politics. Due to the fact that Republicans had a higher average, it may show that they are mainly moved by religious and traditional means in politics.

Vote %>%
  select(PartyIdentification, GlobWarmExist) %>%
  filter(PartyIdentification == "Democrat"| PartyIdentification == "Republican") %>%
   group_by(PartyIdentification, GlobWarmExist) %>%
  summarize(n=n()) %>%
  mutate(percent=n/sum(n))
## # A tibble: 12 x 4
## # Groups:   PartyIdentification [2]
##    PartyIdentification GlobWarmExist                n percent
##    <chr>               <chr>                    <int>   <dbl>
##  1 Democrat            Definitely is happening   1906 0.634  
##  2 Democrat            Definitely not happening    58 0.0193 
##  3 Democrat            Not Sure                   165 0.0549 
##  4 Democrat            Probably is happening      727 0.242  
##  5 Democrat            Probably not happening     128 0.0426 
##  6 Democrat            <NA>                        20 0.00666
##  7 Republican          Definitely is happening    235 0.102  
##  8 Republican          Definitely not happening   626 0.271  
##  9 Republican          Not Sure                   171 0.0740 
## 10 Republican          Probably is happening      595 0.257  
## 11 Republican          Probably not happening     669 0.289  
## 12 Republican          <NA>                        15 0.00649

#From summarizing the sum of Party Identification for Democrats and Republicans and GlobWarmExist, I see that Democrats strongly believe that global warming is an existing issue, especially at 63%. Meanwhile, I see that Republicans’ feelings on global warming are widely dispered, but “Definitely not happening” dominates their viewpoint on global warming at 27%. This shows how Democrats may pay attention to matters that affects everyone of all backgrounds; however, Republicans may chose not to be aware of the planet’s and everyone’s wellbeing.

new_Vote <- Vote %>%
  filter(PartyIdentification == "Democrat"| PartyIdentification == "Republican")

table(new_Vote$PartyIdentification, new_Vote$GlobWarmExist) %>%
  prop.table(2)
##             
##              Definitely is happening Definitely not happening   Not Sure
##   Democrat                0.89023821               0.08479532 0.49107143
##   Republican              0.10976179               0.91520468 0.50892857
##             
##              Probably is happening Probably not happening
##   Democrat              0.54992436             0.16060226
##   Republican            0.45007564             0.83939774

#From this cross-tabulation, I see that Democrats are dominating “Definitely is happening” at 89%, with Republicans at 11%. Furthermore, Republicans strongly believe that global warming is “Definitely not happening” at 91% and “Probably not happening” at 84%. For “Not Sure”, I see that Republicans are higher at 50% and Democrats are at 49%. Lastly, “Probably is happening” for Republicans are at 45% and Democrats are at 55%. From the last two sections that I summarized, I definitely see more sureness for global warming existing for Democrats more than Republicans. Overall, the results show how Republicans may choose to not be aware of the climate of our planet. Additionally, the results could correlate to how religious Republicans may be, especially with the case of Galileo vs Religion, like how Galileo argued against the “geocentric notion” that everything revolved around the Earth. Perhaps Republicans choose to pay attention to their wellbeing and their faith in lieu of being aware of the science and the facts like people from Galileo’s time.

Comparison between two groups:

#Between the two groups average rate, I see that Democrats have lower average rates compared to Republicans. This demonstrates how Democrats may feel the the policing of society may develop systematic issues and major social gaps between those of higher class and lower class. For the religion aspect, Democrats may choose to be realistic and objective with what is going on with the planet and solve issues at a macro-level aspect that pays attention to everybody’s well-being. On the other hand, I see that Republicans have a higher average rate for the policing of society possibly due to them wanting to feel safe and protected. Republicans also have a higher average rate for religion probably because they were conditioned to be followers of religion and subjectively solve problems through a micro lens that neglects the macro aspect.

#Between the two groups sums, I see that Democrats are more against guns and believe that global warming exists. This displays how Democrats may choose to focus on the wellbeing of the people and the planet. For Republicans, they are more pro-guns and lean more against global warming existing. The reasons for the Republicans results could be due to them wanting to create a separation/isolation between social classes, to feel safe from certain social classes, to feel closer to religion, and to thinking for themselves instead of everybody else.

#From the cross-tabulations, I see that both groups have strong opinions on guns and global warming. This could all tie down from what the group wants. Democrats lean more on a side that focuses on ensuring that all social classes in society are not neglected and being realistic with matters that could affect everybody’s wellbeing. Republicans lean more on a perspective that priotizes more on their faith and their own wellbeing.