voterData <- read.csv("~\\Major\\data science\\DATA_333\\Abbreviated Dataset Labeled(October Only)(1).csv")
head(voterData)
No, across all levels of education, the majority of respondents identify as democrat and the fewest respondents identify as not sure or other. However, respondents with no high school or no college education are more likely to be identify as republican than independent.
kable(voterData %>%
group_by(education, PartyIdentification) %>%
summarize(n=n()) %>%
mutate(percent = n/sum(n))) %>%
kable_styling() %>%
scroll_box(height = "300px")
| education | PartyIdentification | n | percent |
|---|---|---|---|
| 2-year | Democrat | 299 | 0.3813776 |
| 2-year | Independent | 243 | 0.3099490 |
| 2-year | Not Sure | 10 | 0.0127551 |
| 2-year | Other | 9 | 0.0114796 |
| 2-year | Republican | 223 | 0.2844388 |
| 4-year | Democrat | 710 | 0.3600406 |
| 4-year | Independent | 663 | 0.3362069 |
| 4-year | Not Sure | 11 | 0.0055781 |
| 4-year | Other | 31 | 0.0157201 |
| 4-year | Republican | 557 | 0.2824544 |
| High School Graduate | Democrat | 743 | 0.3758220 |
| High School Graduate | Independent | 512 | 0.2589782 |
| High School Graduate | Not Sure | 49 | 0.0247850 |
| High School Graduate | Other | 25 | 0.0126454 |
| High School Graduate | Republican | 648 | 0.3277693 |
| No High School | Democrat | 62 | 0.3734940 |
| No High School | Independent | 38 | 0.2289157 |
| No High School | Not Sure | 3 | 0.0180723 |
| No High School | Other | 3 | 0.0180723 |
| No High School | Republican | 60 | 0.3614458 |
| Post Grad | Democrat | 452 | 0.3735537 |
| Post Grad | Independent | 413 | 0.3413223 |
| Post Grad | Not Sure | 6 | 0.0049587 |
| Post Grad | Other | 13 | 0.0107438 |
| Post Grad | Republican | 326 | 0.2694215 |
| Some College | Democrat | 733 | 0.3911419 |
| Some College | Independent | 593 | 0.3164354 |
| Some College | Not Sure | 27 | 0.0144077 |
| Some College | Other | 27 | 0.0144077 |
| Some College | Republican | 494 | 0.2636073 |
| NA | Democrat | 5 | 0.2941176 |
| NA | Independent | 9 | 0.5294118 |
| NA | Republican | 3 | 0.1764706 |
voterData %>%
group_by(education, PartyIdentification) %>%
summarize(n=n()) %>%
mutate(percent = n/sum(n)) %>%
ggplot() +
geom_col(aes(x=education, y=percent, fill=PartyIdentification)) +
theme(axis.text.x = element_text(angle = 90)) +
scale_fill_solarized("red")
NA
Yes, the majority of respondents in the Midwest, Northwest, and those not in the U.S. have the highest education level of a high school graduate, while the majority of respondents in the South and in the West have the highest education level of a 4-year college. But, across all regions, the fewest amount of people have no high school education.
kable(voterData %>%
group_by(region, education) %>%
summarize(n=n()) %>%
mutate(percent = n/sum(n))) %>%
kable_styling() %>%
scroll_box(height = "300px")
| region | education | n | percent |
|---|---|---|---|
| Midwest | 2-year | 181 | 0.0998345 |
| Midwest | 4-year | 410 | 0.2261445 |
| Midwest | High School Graduate | 539 | 0.2972973 |
| Midwest | No High School | 33 | 0.0182019 |
| Midwest | Post Grad | 242 | 0.1334804 |
| Midwest | Some College | 405 | 0.2233867 |
| Midwest | NA | 3 | 0.0016547 |
| Northwest | 2-year | 117 | 0.0788941 |
| Northwest | 4-year | 346 | 0.2333109 |
| Northwest | High School Graduate | 438 | 0.2953473 |
| Northwest | No High School | 22 | 0.0148348 |
| Northwest | Post Grad | 267 | 0.1800405 |
| Northwest | Some College | 291 | 0.1962239 |
| Northwest | NA | 2 | 0.0013486 |
| Not in the US | 2-year | 6 | 0.1111111 |
| Not in the US | 4-year | 11 | 0.2037037 |
| Not in the US | High School Graduate | 17 | 0.3148148 |
| Not in the US | No High School | 1 | 0.0185185 |
| Not in the US | Post Grad | 9 | 0.1666667 |
| Not in the US | Some College | 10 | 0.1851852 |
| South | 2-year | 269 | 0.1002983 |
| South | 4-year | 663 | 0.2472036 |
| South | High School Graduate | 651 | 0.2427293 |
| South | No High School | 70 | 0.0260999 |
| South | Post Grad | 367 | 0.1368382 |
| South | Some College | 655 | 0.2442207 |
| South | NA | 7 | 0.0026100 |
| West | 2-year | 206 | 0.1071243 |
| West | 4-year | 535 | 0.2782111 |
| West | High School Graduate | 322 | 0.1674467 |
| West | No High School | 38 | 0.0197608 |
| West | Post Grad | 314 | 0.1632865 |
| West | Some College | 503 | 0.2615705 |
| West | NA | 5 | 0.0026001 |
| NA | 2-year | 5 | 0.1111111 |
| NA | 4-year | 7 | 0.1555556 |
| NA | High School Graduate | 10 | 0.2222222 |
| NA | No High School | 2 | 0.0444444 |
| NA | Post Grad | 11 | 0.2444444 |
| NA | Some College | 10 | 0.2222222 |
voterData %>%
group_by(region, education) %>%
summarize(n=n()) %>%
mutate(percent = n/sum(n)) %>%
ggplot() + geom_col(aes(x=region, y=percent, fill=education)) +
theme(axis.text.x = element_text(angle = 90)) +
scale_fill_solarized("yellow")
Yes, the majority of respondents in cities and suburbs have a highest education level of 4-years of college, while the majority of respondents in rural areas, towns, and other places have graduate degrees.
kable(voterData %>%
group_by(urbancity, education) %>%
summarize(n=n()) %>%
mutate(percent = n/sum(n))) %>%
kable_styling() %>%
scroll_box(height = "300px")
| urbancity | education | n | percent |
|---|---|---|---|
| City | 2-year | 209 | 0.0925188 |
| City | 4-year | 584 | 0.2585215 |
| City | High School Graduate | 496 | 0.2195662 |
| City | No High School | 49 | 0.0216910 |
| City | Post Grad | 366 | 0.1620186 |
| City | Some College | 552 | 0.2443559 |
| City | NA | 3 | 0.0013280 |
| Other | 2-year | 8 | 0.1568627 |
| Other | 4-year | 9 | 0.1764706 |
| Other | High School Graduate | 18 | 0.3529412 |
| Other | No High School | 1 | 0.0196078 |
| Other | Post Grad | 8 | 0.1568627 |
| Other | Some College | 7 | 0.1372549 |
| Rural Area | 2-year | 149 | 0.1004720 |
| Rural Area | 4-year | 252 | 0.1699258 |
| Rural Area | High School Graduate | 533 | 0.3594066 |
| Rural Area | No High School | 48 | 0.0323668 |
| Rural Area | Post Grad | 145 | 0.0977748 |
| Rural Area | Some College | 350 | 0.2360081 |
| Rural Area | NA | 6 | 0.0040459 |
| Suburb | 2-year | 310 | 0.1032645 |
| Suburb | 4-year | 838 | 0.2791472 |
| Suburb | High School Graduate | 603 | 0.2008661 |
| Suburb | No High School | 37 | 0.0123251 |
| Suburb | Post Grad | 532 | 0.1772152 |
| Suburb | Some College | 679 | 0.2261825 |
| Suburb | NA | 3 | 0.0009993 |
| Town | 2-year | 100 | 0.0876424 |
| Town | 4-year | 272 | 0.2383874 |
| Town | High School Graduate | 311 | 0.2725679 |
| Town | No High School | 30 | 0.0262927 |
| Town | Post Grad | 151 | 0.1323401 |
| Town | Some College | 273 | 0.2392638 |
| Town | NA | 4 | 0.0035057 |
| NA | 2-year | 8 | 0.1250000 |
| NA | 4-year | 17 | 0.2656250 |
| NA | High School Graduate | 16 | 0.2500000 |
| NA | No High School | 1 | 0.0156250 |
| NA | Post Grad | 8 | 0.1250000 |
| NA | Some College | 13 | 0.2031250 |
| NA | NA | 1 | 0.0156250 |
voterData %>%
group_by(urbancity, education) %>%
summarize(n=n()) %>%
mutate(percent = n/sum(n)) %>%
ggplot() + geom_col(aes(x=urbancity, y=percent, fill=education)) +
theme(axis.text.x = element_text(angle = 90)) +
scale_fill_solarized("red")
No, across all levels of education, the majority of respondents believe that abortion should be legal in some cases and illegal in others, and the fewest respondents are unsure.
kable(voterData %>%
group_by(education, Abortion) %>%
summarize(n=n()) %>%
mutate(percent = n/sum(n))) %>%
kable_styling() %>%
scroll_box(height = "300px")
| education | Abortion | n | percent |
|---|---|---|---|
| 2-year | Illegal in all cases | 107 | 0.1364796 |
| 2-year | Legal in all cases | 254 | 0.3239796 |
| 2-year | Legal in some cases and Illegal in others | 376 | 0.4795918 |
| 2-year | Not sure | 40 | 0.0510204 |
| 2-year | NA | 7 | 0.0089286 |
| 4-year | Illegal in all cases | 238 | 0.1206897 |
| 4-year | Legal in all cases | 771 | 0.3909736 |
| 4-year | Legal in some cases and Illegal in others | 851 | 0.4315416 |
| 4-year | Not sure | 93 | 0.0471602 |
| 4-year | NA | 19 | 0.0096349 |
| High School Graduate | Illegal in all cases | 335 | 0.1694487 |
| High School Graduate | Legal in all cases | 550 | 0.2781993 |
| High School Graduate | Legal in some cases and Illegal in others | 929 | 0.4699039 |
| High School Graduate | Not sure | 148 | 0.0748609 |
| High School Graduate | NA | 15 | 0.0075873 |
| No High School | Illegal in all cases | 40 | 0.2409639 |
| No High School | Legal in all cases | 31 | 0.1867470 |
| No High School | Legal in some cases and Illegal in others | 77 | 0.4638554 |
| No High School | Not sure | 16 | 0.0963855 |
| No High School | NA | 2 | 0.0120482 |
| Post Grad | Illegal in all cases | 139 | 0.1148760 |
| Post Grad | Legal in all cases | 505 | 0.4173554 |
| Post Grad | Legal in some cases and Illegal in others | 515 | 0.4256198 |
| Post Grad | Not sure | 45 | 0.0371901 |
| Post Grad | NA | 6 | 0.0049587 |
| Some College | Illegal in all cases | 224 | 0.1195304 |
| Some College | Legal in all cases | 678 | 0.3617930 |
| Some College | Legal in some cases and Illegal in others | 835 | 0.4455710 |
| Some College | Not sure | 128 | 0.0683031 |
| Some College | NA | 9 | 0.0048026 |
| NA | Illegal in all cases | 4 | 0.2352941 |
| NA | Legal in all cases | 4 | 0.2352941 |
| NA | Legal in some cases and Illegal in others | 6 | 0.3529412 |
| NA | Not sure | 3 | 0.1764706 |
voterData %>%
group_by(education, Abortion) %>%
summarize(n=n()) %>%
mutate(percent = n/sum(n)) %>%
ggplot() + geom_col(aes(x=education, y=percent, fill=Abortion)) +
theme(axis.text.x = element_text(angle = 90)) +
scale_fill_solarized("red")
Yes, the majority of respondents with highest education levels of some college, a 4-years college degree, and post-graduate degrees favor gay marriage, while the majority of respondents with highest education levels of no high school, high school, or a 2-years college degree oppose gay marriage.
kable(voterData %>%
group_by(education, GayMarriage) %>%
summarize(n=n()) %>%
mutate(percent = n/sum(n))) %>%
kable_styling() %>%
scroll_box(height = "300px")
| education | GayMarriage | n | percent |
|---|---|---|---|
| 2-year | Favor | 332 | 0.4234694 |
| 2-year | Not sure | 102 | 0.1301020 |
| 2-year | Oppose | 346 | 0.4413265 |
| 2-year | NA | 4 | 0.0051020 |
| 4-year | Favor | 1018 | 0.5162272 |
| 4-year | Not sure | 211 | 0.1069980 |
| 4-year | Oppose | 735 | 0.3727181 |
| 4-year | NA | 8 | 0.0040568 |
| High School Graduate | Favor | 685 | 0.3464846 |
| High School Graduate | Not sure | 276 | 0.1396055 |
| High School Graduate | Oppose | 1009 | 0.5103692 |
| High School Graduate | NA | 7 | 0.0035407 |
| No High School | Favor | 46 | 0.2771084 |
| No High School | Not sure | 21 | 0.1265060 |
| No High School | Oppose | 98 | 0.5903614 |
| No High School | NA | 1 | 0.0060241 |
| Post Grad | Favor | 657 | 0.5429752 |
| Post Grad | Not sure | 132 | 0.1090909 |
| Post Grad | Oppose | 416 | 0.3438017 |
| Post Grad | NA | 5 | 0.0041322 |
| Some College | Favor | 849 | 0.4530416 |
| Some College | Not sure | 211 | 0.1125934 |
| Some College | Oppose | 811 | 0.4327641 |
| Some College | NA | 3 | 0.0016009 |
| NA | Favor | 6 | 0.3529412 |
| NA | Not sure | 1 | 0.0588235 |
| NA | Oppose | 9 | 0.5294118 |
| NA | NA | 1 | 0.0588235 |
voterData %>%
group_by(education, GayMarriage) %>%
summarize(n=n()) %>%
mutate(percent = n/sum(n)) %>%
ggplot() + geom_col(aes(x=education, y=percent, fill=GayMarriage)) +
theme(axis.text.x = element_text(angle = 90)) +
scale_fill_solarized("red")