This is my first assignment for Reporting in the Digital Age.
library(tidyverse) library(lubridate)
impeach <- read_csv(“https://docs.google.com/spreadsheets/d/e/2PACX-1vRh8d5JaDqBtByzNw2JZF3idaACobDhhk-p7chJoktA0HawELHFOvjQOqCpzGA4MGONvPlR7GASqW-K/pub?gid=1765341510&single=true&output=csv”)
#Filtering the set of data given so that only for impeachment inquiry is no. q1_filter <- impeach %>% filter(for_impeachment==‘NO’)
#Filtering the set of data so that it is only showing members that are against impechment and from a district Trump won. q2_filter <- impeach %>% filter(for_impeachment==‘NO’, p16winningparty==‘R’)
#Filtering the data so that only those who voted against impeachment and are in districts that both Trump and Romney won. q3_filter <- impeach %>% filter(for_impeachment==‘NO’, p16winningparty==‘R’, p12winningparty==‘R’)
#Filtering for results that only show those who voted for impeachment in September 2019. q4_filter <- impeach %>% filter(for_impeachment==‘YES’, date_month==‘9’)
#Filtering for results that only show those who voted for impeahcment and are from a distrcit where Clinton won more than 70 percent of the vote. q5_filter <- impeach %>% filter(for_impeachment==‘YES’, clinton_percent>=‘70.0’)
#Sorted the dataframe based on bachelor’s degree or higher from lowest to highest using the arrange function. q6_arrange <- impeach%>% arrange(pct_bachelors)
#Filtered for no impeachment and then sorted based on bachelor’s degree from lowest to highest. q7_arrange <- impeach%>% filter(for_impeachment==‘NO’) arrange(pct_bachelors)
#First I sorted no on impeachment using arrange function then filtered based on who had bachelor’s percentage below the national average. q8_arrange <- impeach%>% arrange(pct_bachelors) filter (pct_bachelors_compared_to_national==‘below’)
#Used the filter function so that only members from New Jersey who voted no to impeachment are shown. q9_filter <- impeach %>% filter(for_impeachment==‘NO’, state==‘NJ’)
#First I filtered the results for both impeachment and the date and then I sorted that data based on the highest Clinton vote percentages. q10_filter <- impeach %>% filter(for_impeachment==‘YES’, date_year<=‘2019’) arrange(clinton_percent)
#26 #I filtered the data based on who voted no for impeachment and out of those who also comes from districts with a GDP lower than the national figure, then saw there were 26 entries. q11_filter <- impeach %>% filter(for_impeachment==‘NO’, gdp_above_national<=‘BELOW’)