# excel file
data <- read_excel("../01_module4/data/MyData.xlsx")
data
## # A tibble: 32,452 × 20
## year state state_po state_fips state_cen state_ic office district stage
## <dbl> <chr> <chr> <dbl> <dbl> <dbl> <chr> <dbl> <chr>
## 1 1976 ALABAMA AL 1 63 41 US HOUSE 1 GEN
## 2 1976 ALABAMA AL 1 63 41 US HOUSE 1 GEN
## 3 1976 ALABAMA AL 1 63 41 US HOUSE 1 GEN
## 4 1976 ALABAMA AL 1 63 41 US HOUSE 2 GEN
## 5 1976 ALABAMA AL 1 63 41 US HOUSE 2 GEN
## 6 1976 ALABAMA AL 1 63 41 US HOUSE 2 GEN
## 7 1976 ALABAMA AL 1 63 41 US HOUSE 3 GEN
## 8 1976 ALABAMA AL 1 63 41 US HOUSE 3 GEN
## 9 1976 ALABAMA AL 1 63 41 US HOUSE 3 GEN
## 10 1976 ALABAMA AL 1 63 41 US HOUSE 4 GEN
## # ℹ 32,442 more rows
## # ℹ 11 more variables: runoff <lgl>, special <lgl>, candidate <chr>,
## # party <chr>, writein <lgl>, mode <chr>, candidatevotes <dbl>,
## # totalvotes <dbl>, unofficial <lgl>, version <dbl>, fusion_ticket <lgl>
Big Picture Question: What Effect does the political party of the President have on which party wins more seats in the House of Representatives?
Short Term Question:Are there more candidates for the House of Representatives during presidential election years than there are during midterm election years?
ggplot(data = data) +
geom_bar(mapping = aes(x = year,))
There appears to be some correlation with there being more candidates running for congress in presidential election years than during midterm election years. When comparing the number of candidates that ran during a presidential election year vs in a midterm election year 2 years later most of the time there were more candidates during the year of the presidential election. There are some exceptions to this such as there being more candidates in 2010 than in 2008. The spike in candidates during the 90’s might possibly have to do with Ross Perot being a relatively popular third-party candidate during the 1992 and 1996 presidential elections which may have in turned caused more candidates to be confident that they could win in down ballot races such as their local congressional district.