Graph 1
a5data <- as.data.frame(midwest)
ggplot(a5data, aes(x = percbelowpoverty)) + geom_histogram(binwidth=5)

Graph 2
ggplot(a5data, aes(x=percbelowpoverty, ..density..)) + geom_density(fill = "Red")

Graph 3
ggplot(a5data, aes(x=percbelowpoverty, ..density..)) + geom_histogram(binwidth = 5, color = "black", fill = "yellow") + geom_density(color = "Blue", fill = "green", size = 1, alpha = 0.75)

Graph 4
ggplot(a5data, aes(x=percbelowpoverty, ..density.., fill = state)) + geom_density(alpha = 0.75)

Graph 5
IN_MI <- a5data %>%
filter(state == "IN" | state == "MI")
ggplot(IN_MI, aes(x=percbelowpoverty, ..density.., fill = state)) + geom_density(alpha = 0.75)

Graph 6
ggplot(a5data, aes(x=percollege, ..density.., fill = state)) + geom_density(alpha = 0.75)

Graph 7
ggplot(IN_MI, aes(x=percollege, ..density.., fill = state)) + geom_density(alpha = 0.75)

Graph 8
ggplot(a5data, aes(x = state, y = percollege, fill = state)) + geom_boxplot()

Graph 9
ggplot(a5data, aes(x = state, y = percollege, fill = state)) + geom_violin() + geom_boxplot(fill = "white" , width = 0.2)

Graph 10
meanperc <- a5data %>%
group_by(county, state) %>%
summarise(mean_perc = mean(percprof))
ggplot(meanperc, aes(x = state, y = mean_perc)) + geom_bar(stat = "identity")

Graph 11
ggplot(a5data, aes(x = percollege, y = percbelowpoverty)) + geom_point()

Graph 12
ggplot(a5data, aes(x = percollege, y = percbelowpoverty)) + geom_point() + geom_smooth(method = loess)

Graph 13
ggplot(a5data, aes(x = percollege, y = percbelowpoverty, color = percbelowpoverty, size = popdensity)) + geom_point()

Graph 14
econ_time <- as.data.frame(economics)
graph14_var <- econ_time %>%
mutate(unemployrate = unemploy / pop)
ggplot(graph14_var, aes(x = date, y = unemployrate)) + geom_line()

Graph 15
fuelecon <- as.data.frame(mpg)
ggplot(fuelecon, aes(x = class, y = hwy, fill = class)) + geom_boxplot()

Graph 16
fuelecon_08 <- fuelecon %>%
filter(year == 2008)
ggplot(fuelecon_08, aes(x = class, y = hwy, fill = class)) + geom_boxplot()

Graph 17
fuelecon <- fuelecon %>%
mutate(fact_yr = as.factor(year))
ggplot(fuelecon, aes(x = cty, ..density.., fill = fact_yr)) + geom_density(alpha = 0.5)

Graph 18
ggplot(fuelecon_08, aes(x = cty, y = hwy)) + geom_point() + geom_smooth(method = loess)

Graph 19
ggplot(fuelecon_08, aes(x = drv, y = hwy, fill = drv)) + geom_boxplot()

Graph 20
ggplot(fuelecon_08, aes(x = drv, y = hwy, fill = drv)) + geom_violin() + geom_boxplot(fill = "white", width = 0.1)
