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(gapminder)
library(readr)
library(ggplot2)

The Data

Data1 <- read_csv("~/Downloads/Abbreviated Dataset Labeled.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.
head(Data1)
## # 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>

Complete this assignment to receive up to 5 of the points that you missed on the skills drill. Be sure to use the updated March Voter data that is provided in the course info section of blackboard.

Identify two groups of respondents who can be segmented from the voter data according to one of the variables in the dataset.

For every table that is produced, you should write 1-2 sentences interpreting your table. Each table should be produced in a separate R chunk, each which has a header, and interpretive text leading up to the R chunk to describe the table being presented.

Post on Rpubs, and post your Rpubs link here.

Topics about Religion that other party members might discuss about, and believe in.

Religion variable ReligiousImportance variable ChurchAttendance variable PrayerFrequency variable

Christianity

#Compare the average 0-100 feeling towards religion, specifically, Christianity (ft_christ_2017) for Democracts & Republicans (PartyIdentification)

Data1 %>%
  filter(PartyIdentification %in% c("Democrat","Republican")) %>%
  group_by(PartyIdentification)%>%
  summarize(AVG = mean(ft_christ_2017, na.rm=TRUE))
## # A tibble: 2 x 2
##   PartyIdentification   AVG
##   <chr>               <dbl>
## 1 Democrat             63.8
## 2 Republican           85.4

In this data, it shows that the average between the Democrats and Republican and saying which political party has more people who are Christian. In the data, it shows that Republicans have more Christian than the Democrats.

Muslim

#Compare the average 0-100 feeling towards being religion, specifically, Islam (ft_muslim_2017) for Democracts & Republicans (PartyIdentification)

Data1 %>%
  filter(PartyIdentification %in% c("Democrat","Republican")) %>%
  group_by(PartyIdentification)%>%
  summarize(AVG = mean(ft_muslim_2017, na.rm=TRUE))
## # A tibble: 2 x 2
##   PartyIdentification   AVG
##   <chr>               <dbl>
## 1 Democrat             62.8
## 2 Republican           34.8

In this data, its shows the average between the Democrat and Republican and saying which political party has more people who are Muslim. In the data, it shows that the Democrats have more Islam believers than Republicans.

Jewish

#Compare the average 0-100 feeling towards religion, specifically, Jewish (ft_jew_2017) for Democracts & Republicans (PartyIdentification)

Data1 %>%
  filter(PartyIdentification %in% c("Democrat","Republican")) %>%
  group_by(PartyIdentification)%>%
  summarize(AVG = mean(ft_jew_2017, na.rm=TRUE))
## # A tibble: 2 x 2
##   PartyIdentification   AVG
##   <chr>               <dbl>
## 1 Democrat             77.4
## 2 Republican           78.7

In this data, it shows that the average between the Democrat and Republican and saying which political party has more people who are Jewish. In this data, it shows that Republican has a little bit more Jewish followers than Democrats.

Evangilism

#Compare the average 0-100 feeling towards, specifically, Evangilism (ft_evang_2017) for Democracts & Republicans (PartyIdentification)

Data1 %>%
  filter(PartyIdentification %in% c("Democrat","Republican")) %>%
  group_by(PartyIdentification) %>%
  summarize(AVG = mean(ft_evang_2017, na.rm=TRUE))
## # A tibble: 2 x 2
##   PartyIdentification   AVG
##   <chr>               <dbl>
## 1 Democrat             40.7
## 2 Republican           74.1

In this data, it shows that the average between the Democrat and Republican and saying which political party has more people who believe in Evangelism and share the teaching of the Gospel. In this data, it shows that Republican have more Evangelism people than Democrats.

Church Attendance for Christian

#Compare the average 0-100 feeling towards church attendance (ChurchAttendance), specifically, Christianity (ft_christ_2017) for Democracts & Republicans (PartyIdentification)

Data1 %>%
  filter(PartyIdentification %in% c("Democrat","Republican")) %>%
  group_by(PartyIdentification,ChurchAttendance) %>%
  summarize(AVG = mean(ft_christ_2017, na.rm=TRUE))
## # A tibble: 16 x 3
## # Groups:   PartyIdentification [2]
##    PartyIdentification ChurchAttendance        AVG
##    <chr>               <chr>                 <dbl>
##  1 Democrat            A few times a year     68.8
##  2 Democrat            Don't Know             71.6
##  3 Democrat            More than once a week  84.2
##  4 Democrat            Never                  46.2
##  5 Democrat            Once a week            80.3
##  6 Democrat            Once or twice a month  77.6
##  7 Democrat            Seldom                 66.1
##  8 Democrat            <NA>                   76.2
##  9 Republican          A few times a year     85.5
## 10 Republican          Don't Know             89.8
## 11 Republican          More than once a week  91.7
## 12 Republican          Never                  73.2
## 13 Republican          Once a week            90.4
## 14 Republican          Once or twice a month  88.7
## 15 Republican          Seldom                 83.5
## 16 Republican          <NA>                  NaN

In this data, it shows that the average between the Democrat and Republican and saying which political party has more people who believe in Christianity and attend church. In this data, it shows that Republican have more Christian people who attend Church than Democrats.