Students are to make a infographic on a wide range of topics concerning Congress. The data for this project was taken from Kaggle and is from FiveThirtyEight’s Congress Trump Score dataset. The data is a tally of how congress members vote compared to President Trump’s desired outcome. The data can be found here.
In addition to the base package, this project only will use 2 other packages. Rio will be used for reading the data into R and ggplot2 will be used to visualize the data.
library('pacman')
p_load('rio', 'ggplot2')
congress_trump = import('/Users/danieltheng/Documents/Daniel Theng/PLSI 2H/cts.csv')
fig = ggplot(data = congress_trump, aes(x = trump_score, fill = party, color = party)) +
geom_histogram(bins = 45) +
scale_fill_manual(values=c("steelblue1", "springgreen1", "coral3")) +
scale_color_manual(values=c("steelblue1", "springgreen1", "coral3")) +
labs(title = 'Distribution of Congress Agreement with President Trump',
x = 'Trump Score',
y = 'Frequency')
fig
The histogram shows the distribution of congress members’ frequencies voting in line with President Trump’s desired outcome. High ‘Trump Scores’, reflects frequent agreement with President Trump. The histogram illustrates 2 distinct peaks which falls in line with 2 populations in Congress: Democrats and Republicans. There seems to be a lot more solidarity within the Republican party, since the peak sits squarely at a ‘Trump Score’ of 1. On the other hand, Democrats have a much more normal distribution that is skewed slightly right, which could reflect the much more diverse opinions within the Democratic Party.
ggsave('/Users/danieltheng/Documents/Daniel Theng/PLSI 2H/Congress_Infograhic.png')
## Saving 7 x 5 in image