#install.packages("dplyr")
#install.packages("knitr")
#install.packages("ggplot2")
#install.packages("tidyr")

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


voterdata <- read.csv("~/Downloads/Abbreviated Dataset Labeled(October Only)(1).csv")




  
  new_data <-voterdata%>%
  mutate(PartyIdentification = factor(PartyIdentification, levels = c("Democrat", "Republican", "Independent","Not Sure", "Other")))

 table(new_data$PartyIdentification, new_data$gender)%>%
  prop.table(2)%>%
  round(2)
          Female Male

Democrat 0.46 0.29 Republican 0.26 0.32 Independent 0.26 0.36 Not Sure 0.02 0.01 Other 0.01 0.02

 new_data%>%

  group_by(PartyIdentification, gender )%>%
  summarise(n=n())%>%
 mutate(percent=n/sum(n))%>%
  ggplot()+
  geom_col(aes(gender, y=percent, fill=PartyIdentification))

Gender and Party Indentification

Most females where not sure which party to identify with. While males mostly identified with other catagory. Overall male party affliation is spread with the leading category being other followed by Independent/Decline to State/No Party.

library(dplyr)
library(knitr)
library(ggplot2)
library(tidyr)


new_data <-voterdata%>%
    mutate(DeathPenalty = factor(DeathPenalty, levels = c("Favor", "Oppose","Not Sure")))

table(new_data$DeathPenalty, new_data$gender)%>%
  prop.table(2)%>%
  round(2)
       Female Male

Favor 0.55 0.65 Oppose 0.26 0.25 Not Sure 0.19 0.11

new_data%>%
  group_by(DeathPenalty, gender)%>%
  summarise(n=n())%>%
   mutate(percent=n/sum(n))%>%
  ggplot()+
  geom_col(aes(gender, y=percent, fill=DeathPenalty))
## Warning: Factor `DeathPenalty` contains implicit NA, consider using
## `forcats::fct_explicit_na`

## Warning: Factor `DeathPenalty` contains implicit NA, consider using
## `forcats::fct_explicit_na`

Gender on Capital Punishment?

Mostly males favored the death penalty while most females were not sure about favor or not favoring death pentalty.

library(dplyr)
library(knitr)
library(ggplot2)
library(tidyr)

new_data <-voterdata%>%
    mutate(TaxWealthy = factor(TaxWealthy, levels = c("Favor", "Oppose","Not Sure", "NA")))


table(new_data$TaxWealthy, new_data$gender)%>%
  prop.table(2)%>%
  round(2)
       Female Male

Favor 0.77 0.57 Oppose 0.23 0.43 Not Sure 0.00 0.00 NA 0.00 0.00

new_data%>%
  group_by(TaxWealthy, gender)%>%
  summarise(n=n())%>%
 
  mutate(percent=n/sum(n))%>%
ggplot()+
  geom_col(aes(gender, y=percent, fill=TaxWealthy))
## Warning: Factor `TaxWealthy` contains implicit NA, consider using
## `forcats::fct_explicit_na`

## Warning: Factor `TaxWealthy` contains implicit NA, consider using
## `forcats::fct_explicit_na`

Gender on Higher Taxation for Higher Income Brackets

Females favored taxing the wealthy as opposed to males. Howver, the leading category had the females being unsure of favor an increase in taxes for those with incomes above $200,000. Most males opposed increasing taxes.

library(dplyr)
library(knitr)
library(ggplot2)
library(tidyr)

new_data <-voterdata%>%
    mutate(ImmigrantContributions = factor(ImmigrantContributions, levels = c("Mostly Contribute", "Mostly a Drain","Neither", "Not Sure", "NA")))


table(new_data$ImmigrantContributions, new_data$gender)%>%
  prop.table(2)%>%
  round(2)
                Female Male

Mostly Contribute 0.25 0.28 Mostly a Drain 0.51 0.54 Neither 0.12 0.12 Not Sure 0.12 0.05 NA 0.00 0.00

new_data%>%
  group_by(ImmigrantContributions, gender)%>%
  summarise(n=n())%>%
  
 
mutate(percent=n/sum(n))%>%
  ggplot()+
  geom_col(aes(gender, y=percent, fill=ImmigrantContributions))
## Warning: Factor `ImmigrantContributions` contains implicit NA, consider
## using `forcats::fct_explicit_na`

## Warning: Factor `ImmigrantContributions` contains implicit NA, consider
## using `forcats::fct_explicit_na`

Gender on on Immigration

Males mostly believe, according to the data that immigrants mostly contribute to the countries resources overall. While females overall were not sure if immigrants contribute or drain the countries resources.

library(dplyr)
library(knitr)
library(ggplot2)
library(tidyr)


new_data <-voterdata%>%
    mutate(ImmigrantNaturalization = factor(ImmigrantNaturalization, levels = c("Favor", "Oppose","Not Sure", "NA")))

table(new_data$ImmigrantNaturalization, new_data$gender)%>%
  prop.table(2)%>%
  round(2)
       Female Male

Favor 0.42 0.42 Oppose 0.34 0.43 Not Sure 0.24 0.15 NA 0.00 0.00

new_data%>%
  group_by(ImmigrantNaturalization, gender)%>%
  summarise(n=n())%>%
   mutate(percent=n/sum(n))%>%
  
ggplot()+
  geom_col(aes(gender, y=percent, fill=ImmigrantNaturalization))
## Warning: Factor `ImmigrantNaturalization` contains implicit NA, consider
## using `forcats::fct_explicit_na`

## Warning: Factor `ImmigrantNaturalization` contains implicit NA, consider
## using `forcats::fct_explicit_na`

Gender on Illegal Immigrant Naturalization Path

Females were not sure about providing a legal way for illegal immigrants already in the Country to become naturalized citizens while males opposed mostly providing a legal way for illegal immigrants already in the Country to become naturalized citizens.

Results

Female Respondents according to the data studied were not sure on certain issues. They are however, least likely to favor the death penalty, uncertain of increasing taxing for those with incomes over 200,000 dollars and are indifferent regarding immigrant contribution to society.