Skip to content

Instantly share code, notes, and snippets.

@ryanburge
Last active March 1, 2017 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanburge/774bf8c4782aad0fff0720d4f99da9d6 to your computer and use it in GitHub Desktop.
Save ryanburge/774bf8c4782aad0fff0720d4f99da9d6 to your computer and use it in GitHub Desktop.
Here's the data link:
simon <- read.csv(url("http://goo.gl/exQA14"))
Here's the link to the codebook:
http://opensiuc.lib.siu.edu/cgi/viewcontent.cgi?article=1010&context=ppi_statepolls
Install these pacakges:
install.packages("dplyr")
install.packages("car")
Load these packages:
library(dplyr)
library(car)
Here are some sample codes:
simon$downstate <- Recode(simon$area, "3=1; else=0")
black <- filter(simon, rac_eth == 2)
hist(simon$area)
Do the following exercises.
1. Create a new dichotomous variable that is a measurement of males. Do the same for females.
2. There's a question in the dataset asking about term limits. Clean that up so that higher values are favor and lower values are oppose.
You have to deal with that "don't know" response, as well.
3. Use filter to create a dataset of just females. And create a dataset of just males.
4. Compare how males and females feel about term limits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment