Safiya

Sociology 333

Instructor Turner

10/21/2018

Homework 7

knitr::opts_chunk$set(
    echo = TRUE,
    message = FALSE,
    warning = FALSE
)
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
library(knitr)


VoterData<-read_csv("/Users/safiesaf/Downloads/VOTER_Survey_July17_Release1-csv.csv")
## Parsed with column specification:
## cols(
##   .default = col_integer(),
##   weight_2017 = col_double(),
##   redovote2016_t_2017 = col_character(),
##   job_title_t_2017 = col_character(),
##   weight_2016 = col_double(),
##   izip_2016 = col_character(),
##   presvote16post_t_2016 = col_character(),
##   second_chance_t_2016 = col_character(),
##   race_other_2016 = col_character(),
##   healthcov_t_2016 = col_character(),
##   employ_t_2016 = col_character(),
##   pid3_t_2016 = col_character(),
##   religpew_t_2016 = col_character(),
##   votemeth16_rnd_2016 = col_character(),
##   presvote16post_rnd_2016 = col_character(),
##   vote2016_cand2_rnd_2016 = col_character(),
##   Clinton_Rubio_rnd_2016 = col_character(),
##   Clinton_Cruz_rnd_2016 = col_character(),
##   Sanders_Trump_rnd_2016 = col_character(),
##   Sanders_Rubio_rnd_2016 = col_character(),
##   second_chance_rnd_2016 = col_character()
##   # ... with 123 more columns
## )
## See spec(...) for full column specifications.
NewishVoterData<-VoterData%>%

rename("Gender"=gender_baseline,
       "Feelings_To_Police"=ft_police_2017)%>%

mutate(Gender=ifelse(Gender==1,"Male","Female"),
      Feelings_To_Police=ifelse(Feelings_To_Police==997,NA,Feelings_To_Police))

head(NewishVoterData)
## # A tibble: 6 x 867
##   case_identifier weight_2017 wishvote2016_20… regretvote2016_…
##             <int>       <dbl>            <int>            <int>
## 1             779       0.438               NA                2
## 2            2108       0.366               NA                2
## 3            2597       0.550               NA                2
## 4            4148      NA                   NA               NA
## 5            4460       0.346               NA                2
## 6            5225       0.148               NA                2
## # ... with 863 more variables: redovote2016_2017 <int>,
## #   redovote2016_t_2017 <chr>, vote2018_2017 <int>,
## #   vote2018_force_2017 <int>, trumpapp_2017 <int>, fav_trump_2017 <int>,
## #   fav_ryan_2017 <int>, fav_obama_2017 <int>, fav_hrc_2017 <int>,
## #   fav_sanders_2017 <int>, fav_putin_2017 <int>,
## #   political_system_strong_leader_2 <int>,
## #   political_system_army_2017 <int>,
## #   political_system_democratic_2017 <int>,
## #   democracy_importance_2017 <int>, democracy_preference_2017 <int>,
## #   us_democracy_satisfaction_2017 <int>, pres_obey_courts_2017 <int>,
## #   pres_oversight_2017 <int>, pres_news_scrutiny_2017 <int>,
## #   track_2017 <int>, track_moral_climate_2017 <int>,
## #   persfinretro_2017 <int>, econtrend_2017 <int>,
## #   Americatrend_2017 <int>, living_standards_parents_2017 <int>,
## #   futuretrend_2017 <int>, american_dream_2017 <int>,
## #   values_culture_2017 <int>, US_respect_2017 <int>, stranger_2017 <int>,
## #   promise_parent_2017 <int>, promise_repeal_aca_2017 <int>,
## #   promise_wall_2017 <int>, promise_immigration_2017 <int>,
## #   promise_tpp_2017 <int>, promise_tax_2017 <int>,
## #   promise_corruption_2017 <int>, promise_success_parent_2017 <int>,
## #   promise_success_repeal_aca_2017 <int>,
## #   promise_success_wall_2017 <int>,
## #   promise_success_immigration_2017 <int>,
## #   promise_success_tpp_2017 <int>, promise_success_tax_2017 <int>,
## #   promise_success_corruption_2017 <int>, blame_trump_2017 <int>,
## #   blame_media_2017 <int>, blame_dems_2017 <int>, blame_reps_2017 <int>,
## #   blame_courts_2017 <int>, trustgovt_2017 <int>, ft_black_2017 <int>,
## #   ft_white_2017 <int>, ft_hisp_2017 <int>, ft_asian_2017 <int>,
## #   ft_muslim_2017 <int>, ft_jew_2017 <int>, ft_christ_2017 <int>,
## #   ft_fem_2017 <int>, ft_immig_2017 <int>, ft_gays_2017 <int>,
## #   ft_unions_2017 <int>, Feelings_To_Police <int>,
## #   ft_altright_2017 <int>, ft_evang_2017 <int>, ft_dem_2017 <int>,
## #   ft_rep_2017 <int>, imiss_a_2017 <int>, imiss_b_2017 <int>,
## #   imiss_c_2017 <int>, imiss_d_2017 <int>, imiss_e_2017 <int>,
## #   imiss_f_2017 <int>, imiss_g_2017 <int>, imiss_h_2017 <int>,
## #   imiss_i_2017 <int>, imiss_j_2017 <int>, imiss_k_2017 <int>,
## #   imiss_l_2017 <int>, imiss_m_2017 <int>, imiss_n_2017 <int>,
## #   imiss_o_2017 <int>, imiss_p_2017 <int>, imiss_q_2017 <int>,
## #   imiss_r_2017 <int>, imiss_s_2017 <int>, imiss_t_2017 <int>,
## #   imiss_u_2017 <int>, imiss_x_2017 <int>, imiss_y_2017 <int>,
## #   immi_contribution_treat_2017 <int>, immi_contribution_a_2017 <int>,
## #   immi_contribution_b_2017 <int>, immi_naturalize_2017 <int>,
## #   immi_makedifficult_2017 <int>, immi_muslim_2017 <int>,
## #   immigration_cap_2017 <int>, culture_pref_2017 <int>,
## #   contact_english_treat_2017 <int>, contact_english_a_2017 <int>, …

How do Male and Female respondents feel toward Police?

Continuous variable used (ft_police_2017) stands for feelings toward police and is listed on a scale of 0 to 100.

  • 0 indicates Negative Feelings
  • 50 indicates Neutral Feelings
  • 100 indicates Positive Feelings

The table shows how respondents polled when asked about their feeligs toward police, the responses are in percentages (not rounded to a whole number). The results show that when it comes to both male and female respondents, they feel positively towards police and there is little to no signifance in their feelings.

GenderPoliceSummary<-NewishVoterData%>%
#filter(Gender=="Male"|
       #Gender=="Female")%>
group_by(Gender)%>%
summarize(Feelings_To_Police=mean(Feelings_To_Police, na.rm = TRUE))

kable(GenderPoliceSummary)
Gender Feelings_To_Police
Female 75.91523
Male 75.51218

The Histograms below visually displays the respondents’,Male and Female, feelings toward police. The first histogram displays Males feelings toward the police. The second histogram displays Females feelings. Notice that there doesn’t seem to be much difference between the two graphs. This analysis shows that the respondents feel very highly toward police with little to no difference between the genders.

library(ggplot2)

NewishVoterData%>%
  
filter(Gender=="Male")%>%
ggplot()+
geom_histogram(aes(Feelings_To_Police),fill="black")+
ggtitle("Males' Feelings toward Police")

NewishVoterData%>%
filter(Gender=="Female")%>%
ggplot()+
geom_histogram(aes(Feelings_To_Police),fill="hotpink")+
ggtitle("Womens' Feelings toward Police")

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.