David Glassman
General instructions for labs:
Today we are going to work in groups to answer questions of your choice. Our data set of interest looks at 2016 election polls, initally compiled by 538 and linked from here.
You can directly access the .csv in R by using the following code:
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## Loading required package: ggplot2
The goals of this lab are to:
You have roughly 1-hour to conduct the analysis of your choice. At the end, please knit your Markdown file as an HTML. Once knit, click Publish in the top right-hand corner of the HTML. Follow the prompts. Our class user name is SkidmoreDataViz and our password is skidmore.
During the final twenty minutes of class, each group will summarize two charts of their choice.
Note 1: you can link the polls data to the USA mapping data using, for example, the following code:
## [1] 15537 6
## long lat group order region subregion
## 1 -87.46201 30.38968 1 1 alabama <NA>
## 2 -87.48493 30.37249 1 2 alabama <NA>
## 3 -87.52503 30.37249 1 3 alabama <NA>
Note 2: For your presentation, feel free to focus in on one region, state, candidate, or time period, poll grade, etc.
florida <- polls.16 %>%
filter(state == "Florida", pollster == "Ipsos" | pollster == "Google Consumer Surveys")
ggplot(florida, aes(pollster, adjpoll_clinton)) +
geom_bar(stat= "identity") +
xlab("Pollster") +
ylab("Clinton Votes") +
ggtitle("Support for Clinton in Florida")
Note 3: Adjusted poll numbers attempt to account for the demographics of the sample to better represent who will vote on election day.
Note 4: You are allowed to look at actual election results and compare them to the polls if you’d like.