library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.0 ✓ purrr 0.3.3
## ✓ tibble 2.1.3 ✓ dplyr 0.8.5
## ✓ tidyr 1.0.2 ✓ stringr 1.4.0
## ✓ readr 1.3.1 ✓ forcats 0.5.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
Vote <- read_csv("~/Downloads/Voter.csv")
## Parsed with column specification:
## cols(
## .default = col_double(),
## weight_18_24_2018 = col_logical(),
## izip_2019 = col_character(),
## housevote_other_2019 = col_character(),
## senatevote_other_2019 = col_character(),
## senatevote2_other_2019 = col_character(),
## SenCand1Name_2019 = col_character(),
## SenCand1Party_2019 = col_character(),
## SenCand2Name_2019 = col_character(),
## SenCand2Party_2019 = col_character(),
## SenCand3Name_2019 = col_character(),
## SenCand3Party_2019 = col_character(),
## SenCand1Name2_2019 = col_character(),
## SenCand1Party2_2019 = col_character(),
## SenCand2Name2_2019 = col_character(),
## SenCand2Party2_2019 = col_character(),
## SenCand3Name2_2019 = col_character(),
## SenCand3Party2_2019 = col_character(),
## governorvote_other_2019 = col_character(),
## GovCand1Name_2019 = col_character(),
## GovCand1Party_2019 = col_character()
## # ... with 108 more columns
## )
## See spec(...) for full column specifications.
## Warning: 800 parsing failures.
## row col expected actual file
## 2033 weight_18_24_2018 1/0/T/F/TRUE/FALSE .917710168467982 '~/Downloads/Voter.csv'
## 2828 weight_18_24_2018 1/0/T/F/TRUE/FALSE 1.41022291345592 '~/Downloads/Voter.csv'
## 4511 weight_18_24_2018 1/0/T/F/TRUE/FALSE 1.77501243840922 '~/Downloads/Voter.csv'
## 7264 weight_18_24_2018 1/0/T/F/TRUE/FALSE 1.29486870319614 '~/Downloads/Voter.csv'
## 7277 weight_18_24_2018 1/0/T/F/TRUE/FALSE 1.44972719707603 '~/Downloads/Voter.csv'
## .... ................. .................. ................ .......................
## See problems(...) for more details.
head(Vote)
## # A tibble: 6 x 1,282
## weight_2016 weight_2017 weight_panel_20… weight_latino_2… weight_18_24_20…
## <dbl> <dbl> <dbl> <dbl> <lgl>
## 1 0.358 0.438 0.503 NA NA
## 2 0.563 0.366 0.389 NA NA
## 3 0.552 0.550 0.684 NA NA
## 4 0.208 NA NA NA NA
## 5 0.334 0.346 0.322 NA NA
## 6 0.207 0.148 0.594 NA NA
## # … with 1,277 more variables: weight_overall_2018 <dbl>, weight_2019 <dbl>,
## # weight1_2018 <dbl>, weight1_2019 <dbl>, weight2_2019 <dbl>,
## # weight3_2019 <dbl>, cassfullcd <dbl>, vote2020_2019 <dbl>,
## # trumpapp_2019 <dbl>, fav_trump_2019 <dbl>, fav_obama_2019 <dbl>,
## # fav_hrc_2019 <dbl>, fav_sanders_2019 <dbl>, fav_putin_2019 <dbl>,
## # fav_schumer_2019 <dbl>, fav_pelosi_2019 <dbl>, fav_comey_2019 <dbl>,
## # fav_mueller_2019 <dbl>, fav_mcconnell_2019 <dbl>, fav_kavanaugh_2019 <dbl>,
## # fav_biden_2019 <dbl>, fav_warren_2019 <dbl>, fav_harris_2019 <dbl>,
## # fav_gillibrand_2019 <dbl>, fav_patrick_2019 <dbl>, fav_booker_2019 <dbl>,
## # fav_garcetti_2019 <dbl>, fav_klobuchar_2019 <dbl>, fav_gorsuch_2019 <dbl>,
## # fav_kasich_2019 <dbl>, fav_haley_2019 <dbl>, fav_bloomberg_2019 <dbl>,
## # fav_holder_2019 <dbl>, fav_avenatti_2019 <dbl>, fav_castro_2019 <dbl>,
## # fav_landrieu_2019 <dbl>, fav_orourke_2019 <dbl>,
## # fav_hickenlooper_2019 <dbl>, fav_pence_2019 <dbl>, add_confirm_2019 <dbl>,
## # izip_2019 <chr>, votereg_2019 <dbl>, votereg_f_2019 <dbl>,
## # regzip_2019 <dbl>, region_2019 <dbl>, turnout18post_2019 <dbl>,
## # tsmart_G2018_2019 <dbl>, tsmart_G2018_vote_type_2019 <dbl>,
## # tsmart_P2018_2019 <dbl>, tsmart_P2018_party_2019 <dbl>,
## # tsmart_P2018_vote_type_2019 <dbl>, housevote_2019 <dbl>,
## # housevote_other_2019 <chr>, senatevote_2019 <dbl>,
## # senatevote_other_2019 <chr>, senatevote2_2019 <dbl>,
## # senatevote2_other_2019 <chr>, SenCand1Name_2019 <chr>,
## # SenCand1Party_2019 <chr>, SenCand2Name_2019 <chr>,
## # SenCand2Party_2019 <chr>, SenCand3Name_2019 <chr>,
## # SenCand3Party_2019 <chr>, SenCand1Name2_2019 <chr>,
## # SenCand1Party2_2019 <chr>, SenCand2Name2_2019 <chr>,
## # SenCand2Party2_2019 <chr>, SenCand3Name2_2019 <chr>,
## # SenCand3Party2_2019 <chr>, governorvote_2019 <dbl>,
## # governorvote_other_2019 <chr>, GovCand1Name_2019 <chr>,
## # GovCand1Party_2019 <chr>, GovCand2Name_2019 <chr>,
## # GovCand2Party_2019 <chr>, GovCand3Name_2019 <chr>,
## # GovCand3Party_2019 <chr>, inst_court_2019 <dbl>, inst_media_2019 <dbl>,
## # inst_congress_2019 <dbl>, inst_justice_2019 <dbl>, inst_FBI_2019 <dbl>,
## # inst_military_2019 <dbl>, inst_church_2019 <dbl>, inst_business_2019 <dbl>,
## # Democrats_2019 <dbl>, Republicans_2019 <dbl>, Men_2019 <dbl>,
## # Women_2019 <dbl>, wm_2019 <dbl>, ww_2019 <dbl>, bm_2019 <dbl>,
## # bw_2019 <dbl>, hm_2019 <dbl>, hw_2019 <dbl>, rwm_2019 <dbl>,
## # rww_2019 <dbl>, rbm_2019 <dbl>, rbw_2019 <dbl>, pwm_2019 <dbl>, …
Vote <- Vote %>%
rename(imiss_t_2019, abortion_2019 = imiss_t_2019, abortidentity_baseline, abort_identity = abortidentity_baseline, abortview3_baseline, Legalize_Abortion = abortview3_baseline)
Vote <-Vote %>%
mutate(vote2020_2019 =
ifelse(vote2020_2019==1,"Donald Trump",
ifelse(vote2020_2019==2,"The Democratic candidate",
ifelse(vote2020_2019==3, "I would not vote",
ifelse(vote2020_2019==4, "Not sure", NA)))),
abortion_2019 =
ifelse(abortion_2019==1,"Very Important",
ifelse(abortion_2019==2,"Somewhat Important",
ifelse(abortion_2019==3,"Not very Important",
ifelse(abortion_2019==4,"Unimportant", NA)))),
abortion_2019= factor(abortion_2019,
levels=c("Unimportant", "Not very Important", "Somewhat Important", "Very Important")),
abort_identity =
ifelse(abort_identity=="1", "Pro-life",
ifelse(abort_identity=="2", "Pro-choice", NA)),
abort_identity= factor(abort_identity,
levels=c("Pro-life","Pro-choice")),
healthcarelaw1_2019 =
ifelse(healthcarelaw1_2019=="1","Very important",
ifelse(healthcarelaw1_2019=="2","Somewhat important",
ifelse(healthcarelaw1_2019=="3","Not too important",
ifelse(healthcarelaw1_2019=="4","Not at all important", NA)))),
healthcarelaw2_2019 =
ifelse(healthcarelaw2_2019=="1","Very important",
ifelse(healthcarelaw2_2019=="2","Somewhat important",
ifelse(healthcarelaw2_2019=="3","Not too important",
ifelse(healthcarelaw2_2019=="4", "Not at all important", NA)))),
Legalize_Abortion =
ifelse(Legalize_Abortion=="1","Legal in all cases",
ifelse(Legalize_Abortion=="2","Legal in some cases and illegal in others",
ifelse(Legalize_Abortion=="3","Illegal in all cases", NA))),
Legalize_Abortion= factor(Legalize_Abortion, levels=c("Legal in all cases", "Legal in some cases and illegal in others", "Illegal in all cases")),
favorhealth_2019 =
ifelse(favorhealth_2019==1,"Strongly favor",
ifelse(favorhealth_2019==2,"Somewhat favor",
ifelse(favorhealth_2019==3,"Somewhat oppose",
ifelse(favorhealth_2019==4,"Strongly oppose", NA)))),
favorhealth_2019= factor(favorhealth_2019,
levels=c("Strongly oppose","Somewhat oppose", "Somewhat favor", "Strongly favor")),
Women_2019 = ifelse(Women_2019>100,NA, Women_2019)) %>%
filter(vote2020_2019 %in% c("Donald Trump","The Democratic candidate"))
Vote %>%
group_by(vote2020_2019) %>%
summarize(Women_2019 = mean(Women_2019, na.rm=TRUE))
## # A tibble: 2 x 2
## vote2020_2019 Women_2019
## <chr> <dbl>
## 1 Donald Trump 73.0
## 2 The Democratic candidate 81.9
Below is a visualization of the previous table
Vote %>%
filter(vote2020_2019 %in% c("Donald Trump","The Democratic candidate")) %>%
ggplot()+
geom_histogram(aes(x=Women_2019, fill=vote2020_2019))+
facet_wrap(~vote2020_2019)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 305 rows containing non-finite values (stat_bin).
Vote%>%
summarize(Women_2019 = mean(Women_2019,na.rm=TRUE))
## # A tibble: 1 x 1
## Women_2019
## <dbl>
## 1 77.9
Donald_vote <- Vote %>%
filter(vote2020_2019=="Donald Trump")
Donald_vote <-
replicate(10000,
sample(Donald_vote$Women_2019,40) %>%
mean(na.rm=TRUE)) %>%
data.frame()%>%
rename("mean"=1)
Dem_vote <- Vote %>%
filter(vote2020_2019=="The Democratic candidate")
Dem_vote <-
replicate(10000,
sample(Dem_vote$Women_2019,40) %>%
mean(na.rm=TRUE)) %>%
data.frame()%>%
rename("mean"=1)
ggplot()+
geom_histogram(data=Donald_vote, aes(x=mean),fill="red")+ geom_histogram(data=Dem_vote, aes(x=mean),fill="blue")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
t.test(Women_2019~vote2020_2019, data=Vote)
##
## Welch Two Sample t-test
##
## data: Women_2019 by vote2020_2019
## t = -16.006, df = 4588.9, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -9.954328 -7.781945
## sample estimates:
## mean in group Donald Trump mean in group The Democratic candidate
## 73.03526 81.90339
options(scipen =9999)
table(Vote$vote2020_2019)%>%
prop.table()%>%
round(2)
##
## Donald Trump The Democratic candidate
## 0.45 0.55
table(Vote$abortion_2019)%>%
prop.table()%>%
round(2)
##
## Unimportant Not very Important Somewhat Important Very Important
## 0.11 0.18 0.31 0.41
Donald Trump .45 * .11 = .05 Unimportant .45 * .18 = .08 Not very Important .45 * .31 = .14 Somewhat Important .45 * .41 = .18 Very Important
.55 * .11 = .06 Unimportant .55 * .18 = .10 Not very Important .55 * .31 = .17 Somewhat Important .55 * .41 = .23 Very Important
table(Vote$vote2020_2019, Vote$abortion_2019) %>%
prop.table(1)
##
## Unimportant Not very Important Somewhat Important
## Donald Trump 0.11902028 0.18522771 0.27745886
## The Democratic candidate 0.09820322 0.17317224 0.33178439
##
## Very Important
## Donald Trump 0.41829315
## The Democratic candidate 0.39684015
chisq.test(Vote$abortion_2019, Vote$vote2020_2019)
##
## Pearson's Chi-squared test
##
## data: Vote$abortion_2019 and Vote$vote2020_2019
## X-squared = 22.491, df = 3, p-value = 0.00005155
options(scipen =9999)
chisq.test(Vote$vote2020_2019, Vote$abortion_2019)[7]
## $expected
## Vote$abortion_2019
## Vote$vote2020_2019 Unimportant Not very Important Somewhat Important
## Donald Trump 280.9389 466.5912 803.4494
## The Democratic candidate 347.0611 576.4088 992.5506
## Vote$abortion_2019
## Vote$vote2020_2019 Very Important
## Donald Trump 1062.021
## The Democratic candidate 1311.979
chisq.test(Vote$vote2020_2019, Vote$abortion_2019)[6]
## $observed
## Vote$abortion_2019
## Vote$vote2020_2019 Unimportant Not very Important Somewhat Important
## Donald Trump 311 484 725
## The Democratic candidate 317 559 1071
## Vote$abortion_2019
## Vote$vote2020_2019 Very Important
## Donald Trump 1093
## The Democratic candidate 1281
| ## Voter Candidates of 2020’s take on their Abortion identity and view on the whether Abortion should be Illegal or Legal |
| #### How would the votes for Donald Trump and “the Democratic candidate” in 2020 distribute across categories on Abortion identity? |
r table(Vote$abort_identity, Vote$vote2020_2019) %>% prop.table(2) %>% round(2) |
## ## Donald Trump The Democratic candidate ## Pro-life 0.74 0.13 ## Pro-choice 0.26 0.87 |
| ##### We see that those would vote for Donald Trump are more than likely to identify as “Pro-life” for their Aborition identity at 74%. On the other hand, those who would vote for the Democratic candidate are more than likely to identify as “Pro-choice” for their Abortion identity at 87%. |
| #### Stacked Bar Chart Below is a stacked bar chart, visualizing the information in the above table |
r Vote %>% filter(!is.na(abort_identity),!is.na(vote2020_2019)) %>% group_by(abort_identity, vote2020_2019) %>% summarize(n=n()) %>% mutate(percent=n/sum(n)) %>% ggplot () + geom_col(aes(x=abort_identity, y=percent, fill=vote2020_2019)) + theme_minimal() |
| ##### The stacked bar chart clearly depicts how those who would for Donald Trump are more likely to be “Pro-life” and those who would vote for the Democratic candidate are more likely to be “Pro-life”. |
| #### Average view on Abortion |
r table(Vote$Legalize_Abortion, Vote$vote2020_2019) %>% prop.table(1) %>% round(2) |
## ## Donald Trump ## Legal in all cases 0.19 ## Legal in some cases and illegal in others 0.58 ## Illegal in all cases 0.84 ## ## The Democratic candidate ## Legal in all cases 0.81 ## Legal in some cases and illegal in others 0.42 ## Illegal in all cases 0.16 |
| ##### We see that those would vote for Donald Trump strongly believe that Abortion should be “Illegal in all cases” at 84%. On the other hand, those who would vote for the Democratic candidate strongly beleive that Abortion should “Legal in all cases” at 81%. |
| #### Stacked Bar Chart |
r Vote %>% filter(!is.na(Legalize_Abortion),!is.na(vote2020_2019)) %>% group_by(Legalize_Abortion, vote2020_2019) %>% summarize(n=n()) %>% mutate(percent=n/sum(n)) %>% ggplot () + geom_col(aes(x=Legalize_Abortion, y=percent, fill=vote2020_2019)) + theme_minimal() |
| ##### The stacked bar chart reveals that those who would vote for Donald Trump lean more on “Illegal in all cases” and that those who would vote for the Democratic candidate lean more on “Legal in all cases” on the view on Abortion. |
| #### Average feelings toward women in each category on whether abortion should be legal or not |
r Vote%>% group_by(Legalize_Abortion)%>% summarize(Women_2019 = mean(Women_2019, na.rm=TRUE)) |
## Warning: Factor `Legalize_Abortion` contains implicit NA, consider using ## `forcats::fct_explicit_na` |
## # A tibble: 4 x 2 ## Legalize_Abortion Women_2019 ## <fct> <dbl> ## 1 Legal in all cases 81.5 ## 2 Legal in some cases and illegal in others 76.5 ## 3 Illegal in all cases 74.8 ## 4 <NA> 76.5 |
| ##### From the averages, it reveals that those who have negative and weaker feelings on Women believe that Abortion should be Illegal in all cases. In constrast, we see those who think that Abortion should be Legal have positive and stronger feelings on Women. |
| #### Histogram of previous table Below are histograms comparing the distrubution of feelings towards women for those in various categories of satisfaction in health. |
r Vote%>% filter(!is.na(Legalize_Abortion),!is.na(abort_identity))%>% ggplot()+ geom_histogram(aes(x=Women_2019, fill=Legalize_Abortion))+ facet_wrap(~Legalize_Abortion) |
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`. |
## Warning: Removed 120 rows containing non-finite values (stat_bin). |
r theme_minimal() |
## List of 93 ## $ line :List of 6 ## ..$ colour : chr "black" ## ..$ size : num 0.5 ## ..$ linetype : num 1 ## ..$ lineend : chr "butt" ## ..$ arrow : logi FALSE ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_line" "element" ## $ rect :List of 5 ## ..$ fill : chr "white" ## ..$ colour : chr "black" ## ..$ size : num 0.5 ## ..$ linetype : num 1 ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_rect" "element" ## $ text :List of 11 ## ..$ family : chr "" ## ..$ face : chr "plain" ## ..$ colour : chr "black" ## ..$ size : num 11 ## ..$ hjust : num 0.5 ## ..$ vjust : num 0.5 ## ..$ angle : num 0 ## ..$ lineheight : num 0.9 ## ..$ margin : 'margin' num [1:4] 0pt 0pt 0pt 0pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : logi FALSE ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ title : NULL ## $ aspect.ratio : NULL ## $ axis.title : NULL ## $ axis.title.x :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : NULL ## ..$ vjust : num 1 ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 2.75pt 0pt 0pt 0pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ axis.title.x.top :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : NULL ## ..$ vjust : num 0 ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 0pt 0pt 2.75pt 0pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ axis.title.x.bottom : NULL ## $ axis.title.y :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : NULL ## ..$ vjust : num 1 ## ..$ angle : num 90 ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 0pt 2.75pt 0pt 0pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ axis.title.y.left : NULL ## $ axis.title.y.right :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : NULL ## ..$ vjust : num 0 ## ..$ angle : num -90 ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 0pt 0pt 0pt 2.75pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ axis.text :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : chr "grey30" ## ..$ size : 'rel' num 0.8 ## ..$ hjust : NULL ## ..$ vjust : NULL ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : NULL ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ axis.text.x :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : NULL ## ..$ vjust : num 1 ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 2.2pt 0pt 0pt 0pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ axis.text.x.top :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : NULL ## ..$ vjust : num 0 ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 0pt 0pt 2.2pt 0pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ axis.text.x.bottom : NULL ## $ axis.text.y :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : num 1 ## ..$ vjust : NULL ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 0pt 2.2pt 0pt 0pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ axis.text.y.left : NULL ## $ axis.text.y.right :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : num 0 ## ..$ vjust : NULL ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 0pt 0pt 0pt 2.2pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ axis.ticks : list() ## ..- attr(*, "class")= chr [1:2] "element_blank" "element" ## $ axis.ticks.x : NULL ## $ axis.ticks.x.top : NULL ## $ axis.ticks.x.bottom : NULL ## $ axis.ticks.y : NULL ## $ axis.ticks.y.left : NULL ## $ axis.ticks.y.right : NULL ## $ axis.ticks.length : 'unit' num 2.75pt ## ..- attr(*, "valid.unit")= int 8 ## ..- attr(*, "unit")= chr "pt" ## $ axis.ticks.length.x : NULL ## $ axis.ticks.length.x.top : NULL ## $ axis.ticks.length.x.bottom: NULL ## $ axis.ticks.length.y : NULL ## $ axis.ticks.length.y.left : NULL ## $ axis.ticks.length.y.right : NULL ## $ axis.line : list() ## ..- attr(*, "class")= chr [1:2] "element_blank" "element" ## $ axis.line.x : NULL ## $ axis.line.x.top : NULL ## $ axis.line.x.bottom : NULL ## $ axis.line.y : NULL ## $ axis.line.y.left : NULL ## $ axis.line.y.right : NULL ## $ legend.background : list() ## ..- attr(*, "class")= chr [1:2] "element_blank" "element" ## $ legend.margin : 'margin' num [1:4] 5.5pt 5.5pt 5.5pt 5.5pt ## ..- attr(*, "valid.unit")= int 8 ## ..- attr(*, "unit")= chr "pt" ## $ legend.spacing : 'unit' num 11pt ## ..- attr(*, "valid.unit")= int 8 ## ..- attr(*, "unit")= chr "pt" ## $ legend.spacing.x : NULL ## $ legend.spacing.y : NULL ## $ legend.key : list() ## ..- attr(*, "class")= chr [1:2] "element_blank" "element" ## $ legend.key.size : 'unit' num 1.2lines ## ..- attr(*, "valid.unit")= int 3 ## ..- attr(*, "unit")= chr "lines" ## $ legend.key.height : NULL ## $ legend.key.width : NULL ## $ legend.text :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : 'rel' num 0.8 ## ..$ hjust : NULL ## ..$ vjust : NULL ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : NULL ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ legend.text.align : NULL ## $ legend.title :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : num 0 ## ..$ vjust : NULL ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : NULL ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ legend.title.align : NULL ## $ legend.position : chr "right" ## $ legend.direction : NULL ## $ legend.justification : chr "center" ## $ legend.box : NULL ## $ legend.box.just : NULL ## $ legend.box.margin : 'margin' num [1:4] 0cm 0cm 0cm 0cm ## ..- attr(*, "valid.unit")= int 1 ## ..- attr(*, "unit")= chr "cm" ## $ legend.box.background : list() ## ..- attr(*, "class")= chr [1:2] "element_blank" "element" ## $ legend.box.spacing : 'unit' num 11pt ## ..- attr(*, "valid.unit")= int 8 ## ..- attr(*, "unit")= chr "pt" ## $ panel.background : list() ## ..- attr(*, "class")= chr [1:2] "element_blank" "element" ## $ panel.border : list() ## ..- attr(*, "class")= chr [1:2] "element_blank" "element" ## $ panel.spacing : 'unit' num 5.5pt ## ..- attr(*, "valid.unit")= int 8 ## ..- attr(*, "unit")= chr "pt" ## $ panel.spacing.x : NULL ## $ panel.spacing.y : NULL ## $ panel.grid :List of 6 ## ..$ colour : chr "grey92" ## ..$ size : NULL ## ..$ linetype : NULL ## ..$ lineend : NULL ## ..$ arrow : logi FALSE ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_line" "element" ## $ panel.grid.major : NULL ## $ panel.grid.minor :List of 6 ## ..$ colour : NULL ## ..$ size : 'rel' num 0.5 ## ..$ linetype : NULL ## ..$ lineend : NULL ## ..$ arrow : logi FALSE ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_line" "element" ## $ panel.grid.major.x : NULL ## $ panel.grid.major.y : NULL ## $ panel.grid.minor.x : NULL ## $ panel.grid.minor.y : NULL ## $ panel.ontop : logi FALSE ## $ plot.background : list() ## ..- attr(*, "class")= chr [1:2] "element_blank" "element" ## $ plot.title :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : 'rel' num 1.2 ## ..$ hjust : num 0 ## ..$ vjust : num 1 ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 0pt 0pt 5.5pt 0pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ plot.title.position : chr "panel" ## $ plot.subtitle :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : num 0 ## ..$ vjust : num 1 ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 0pt 0pt 5.5pt 0pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ plot.caption :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : 'rel' num 0.8 ## ..$ hjust : num 1 ## ..$ vjust : num 1 ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 5.5pt 0pt 0pt 0pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ plot.caption.position : chr "panel" ## $ plot.tag :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : 'rel' num 1.2 ## ..$ hjust : num 0.5 ## ..$ vjust : num 0.5 ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : NULL ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ plot.tag.position : chr "topleft" ## $ plot.margin : 'margin' num [1:4] 5.5pt 5.5pt 5.5pt 5.5pt ## ..- attr(*, "valid.unit")= int 8 ## ..- attr(*, "unit")= chr "pt" ## $ strip.background : list() ## ..- attr(*, "class")= chr [1:2] "element_blank" "element" ## $ strip.background.x : NULL ## $ strip.background.y : NULL ## $ strip.placement : chr "inside" ## $ strip.text :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : chr "grey10" ## ..$ size : 'rel' num 0.8 ## ..$ hjust : NULL ## ..$ vjust : NULL ## ..$ angle : NULL ## ..$ lineheight : NULL ## ..$ margin : 'margin' num [1:4] 4.4pt 4.4pt 4.4pt 4.4pt ## .. ..- attr(*, "valid.unit")= int 8 ## .. ..- attr(*, "unit")= chr "pt" ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ strip.text.x : NULL ## $ strip.text.y :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : NULL ## ..$ vjust : NULL ## ..$ angle : num -90 ## ..$ lineheight : NULL ## ..$ margin : NULL ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## $ strip.switch.pad.grid : 'unit' num 2.75pt ## ..- attr(*, "valid.unit")= int 8 ## ..- attr(*, "unit")= chr "pt" ## $ strip.switch.pad.wrap : 'unit' num 2.75pt ## ..- attr(*, "valid.unit")= int 8 ## ..- attr(*, "unit")= chr "pt" ## $ strip.text.y.left :List of 11 ## ..$ family : NULL ## ..$ face : NULL ## ..$ colour : NULL ## ..$ size : NULL ## ..$ hjust : NULL ## ..$ vjust : NULL ## ..$ angle : num 90 ## ..$ lineheight : NULL ## ..$ margin : NULL ## ..$ debug : NULL ## ..$ inherit.blank: logi TRUE ## ..- attr(*, "class")= chr [1:2] "element_text" "element" ## - attr(*, "class")= chr [1:2] "theme" "gg" ## - attr(*, "complete")= logi TRUE ## - attr(*, "validate")= logi TRUE |
| ##### From the historgrams, we see that the feelings towards Women go down in order of the histograms from left to right based on the Legalization of Abortion. We see that higher ratings on Women stem from a belief that Abortion should be Legal in all cases, possibly due to respect for Women and that Women should have the right to decide what to do with their own bodies. However, lower ratings on Women stem from a belief that Abortion should be Illegal in all cases, possibly due to religious and patriarchal reasons. |
table(Vote$favorhealth_2019, Vote$vote2020_2019) %>%
prop.table(1) %>%
round(2)
##
## Donald Trump The Democratic candidate
## Strongly oppose 0.87 0.13
## Somewhat oppose 0.58 0.42
## Somewhat favor 0.26 0.74
## Strongly favor 0.13 0.87
Below is a stacked bar chart, visualizing the previous table.
Vote %>%
filter(!is.na(vote2020_2019),!is.na(favorhealth_2019)) %>%
group_by(favorhealth_2019, vote2020_2019) %>%
summarize(n=n()) %>%
mutate(percent=n/sum(n)) %>%
ggplot () +
geom_col(aes(x=favorhealth_2019, y=percent, fill=vote2020_2019)) + theme_minimal()
table(Vote$healthcarelaw1_2019, Vote$vote2020_2019) %>%
prop.table(1) %>%
round(2)
##
## Donald Trump The Democratic candidate
## Not at all important 0.92 0.08
## Not too important 0.86 0.14
## Somewhat important 0.72 0.28
## Very important 0.30 0.70
Vote %>%
filter(!is.na(vote2020_2019),!is.na(healthcarelaw1_2019)) %>%
group_by(healthcarelaw1_2019, vote2020_2019) %>%
summarize(n=n()) %>%
mutate(percent=n/sum(n)) %>%
ggplot () +
geom_col(aes(x=healthcarelaw1_2019, y=percent, fill=vote2020_2019)) + theme_minimal()
table(Vote$healthcarelaw2_2019, Vote$vote2020_2019) %>%
prop.table(1) %>%
round(2)
##
## Donald Trump The Democratic candidate
## Not at all important 0.88 0.12
## Not too important 0.85 0.15
## Somewhat important 0.78 0.22
## Very important 0.34 0.66
Vote %>%
filter(!is.na(vote2020_2019),!is.na(healthcarelaw2_2019)) %>%
group_by(healthcarelaw2_2019, vote2020_2019) %>%
summarize(n=n()) %>%
mutate(percent=n/sum(n)) %>%
ggplot () +
geom_col(aes(x=healthcarelaw2_2019, y=percent, fill=vote2020_2019)) + theme_minimal()