library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.2 v purrr 0.3.4
## v tibble 3.0.3 v dplyr 1.0.2
## v tidyr 1.1.2 v stringr 1.4.0
## v readr 1.3.1 v forcats 0.5.0
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(ggplot2)
library(viridis)
## Warning: package 'viridis' was built under R version 4.0.3
## Loading required package: viridisLite
library(hrbrthemes)
## Warning: package 'hrbrthemes' was built under R version 4.0.3
## NOTE: Either Arial Narrow or Roboto Condensed fonts are required to use these themes.
## Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
## if Arial Narrow is not on your system, please see https://bit.ly/arialnarrow
file_1 <- read.csv("https://raw.githubusercontent.com/prlitics/Election-Data-Science-Fall-2020/master/Data/Week6LabData/ROWAN_absentee_20201103.csv")
file_2 <- read.delim('ncvhis80.txt')
file_3 <- read.delim("ncvoter80.txt")
Single Variable
One single variable question could be how many outliers there are in terms of party registration. So we could try and find how many people are neither, registered democrat, republicn, or unaffiliated.
Another single variable question could be which is the most common method of voting.
What is the least common type of election.
What is the most common voting method.
answer1 <- ggplot(file_2, aes(votingmethod))
answer1 <- answer1 + geom_bar()
Multivariate
Which year has the largest number of democratic voters.
Which party has the highest purportion of accepted Ballots.
What is the most common party affiliation of voters who register more than twice.
Which precinct has the highest number of absentee voters.
What is the most common voting method amongst democrats.
Which party has the highest proportion of accepted Ballots. (Multivariable)
answer2 <- file_1
Answer <- ggplot(data = answer2) + geom_bar (aes(x = '' , y = " " , fill = ballot_rtn_status), postion = "dodge" , stat = "identity") + scale_fill_viridis(discrete = T, option = "C") + facet_wrap(~voter_party_code)
## Warning: Ignoring unknown parameters: postion
Answer<- print(Answer + labs(title = "Ballot Status by Party") + labs(y = "Number of Ballots", x = "Ballot Status") + labs (fill = "Status"))
Answer <- theme_ipsum()