Preparation
# On first use packages must be installed.
# Example: install.packages("haven")
# Load packages used in this session of R
library(knitr)
library(car)
opts_chunk$set(echo = TRUE)
options(digits = 3)
## As needed, set path to folder where data is located.
## For example: opts_knit$set(root.dir ="C:/Data")
1) Load the data set Ch2_Lab_ExitPoll.dta
2) Create dummy variables for each state/DC. How many observations are in each state?
3) Convert the year_born variable into age. Check for and correct data errors. What is the average age of all observations in the data set? The minimum and maximum?
4) What is the distribution of the gender variable? Create a male dummy variable and indicate the distribution of this variable. Compare distribution of the male variable to the distribution of the gender variable.
5) Provide descriptive stats for Trump and Clinton feeling thermometer. Is there anything you need to adjust?
6) Produce histograms of the Clinton and Trump feeling thermometers
7) Create a scatterplot of the Clinton and Trump feeling thermometers
8) What is the distribution of the education variable? Is there any adjustment you would need to make if you will use this as a continuous variable in a regression model?