Skip to content

Instantly share code, notes, and snippets.

Ryan Burge ryanburge

View GitHub Profile
@ryanburge
ryanburge / religious_composition.R
Last active Apr 25, 2019
Religious Composition
View religious_composition.R
gss <- gss %>%
mutate(reltrad = car::recode(reltrad, "NA = 0; 5 =0; 6=0"))
hhh1 <- gss %>%
filter(year == 1978) %>%
filter(partyid == 0 | partyid == 1 | partyid == 2) %>%
ct(reltrad, wt = wtssall) %>%
mutate(year = 1978) %>%
mutate(party = "Democrat")
@ryanburge
ryanburge / final_project.R
Created Apr 19, 2019
Research Methods Final Project - Spring 2019
View final_project.R
## Read in the GSS Data
gss <- read_csv("https://raw.githubusercontent.com/ryanburge/pls2003_sp17/master/gsssmall.csv")
## https://gssdataexplorer.norc.org/
1. How would you describe support for abortion in the four scenarios in the GSS? Does suport vary based on party identification? Race? D
What is the relationship between church attendance and support for abortion?
## Read in the Baseball Data
bball <- read_csv("https://raw.githubusercontent.com/ryanburge/pls2003_sp17/master/bball.csv")
bball <- bball %>%
@ryanburge
ryanburge / 2033_class_41619.R
Last active Apr 16, 2019
Scatterplots and Simple Relationships
View 2033_class_41619.R
## Plotting Lines Graphs ####
gss <- read_csv("https://www.dropbox.com/s/g1r85ff3z8iklvt/gsssmall.csv?dl=1")
## https://gssdataexplorer.norc.org/
## Scatterplots and Simple Relationships
bball <- read_csv("https://raw.githubusercontent.com/ryanburge/pls2003_sp17/master/bball.csv")
bball <- bball %>%
rename(games = g, wins =w, losses = l, runs =r, atbats = ab, hits =h, homeruns =hr, walks = bb, strikeout = so, stolenbase = sb, earnedruns = era)
@ryanburge
ryanburge / dumbbells_pid.R
Last active Apr 9, 2019
Making Dumbbells of PID Moves
View dumbbells_pid.R
library(haven)
library(labelled)
cces08 <- read_dta("D://cces/data/cces08.dta")
cces10 <- read_dta("D://cces/data/cces10.dta")
cces12 <- read_dta("D://cces/data/cces12.dta")
cces14 <- read_dta("D://cces/data/cces14.dta")
cces16 <- read_dta("D://cces/data/cces16.dta")
cces18 <- read_dta("D://cces18.dta")
@ryanburge
ryanburge / assignment_2.R
Created Apr 2, 2019
Assignment 2 - Research Methods
View assignment_2.R
library(socsci)
library(car)
cces <- read_csv("https://raw.githubusercontent.com/ryanburge/cces/master/CCES%20for%20Methods/small_cces.csv")
## Here's a link to download the codebook
https://github.com/ryanburge/cces/raw/master/Codebooks/CCES_2016_Small_Codebook.pdf
## We are going to talk about two things today
1. The group_by() function
2. Confidence Intervals
@ryanburge
ryanburge / count_gss_reltrad.R
Created Mar 30, 2019
Counting Religious Groups in the GSS
View count_gss_reltrad.R
## Read the data in as gss
## This a specific survey weight to use for just 1982 and 1987 because they oversampled African-Americans ###
over <- gss %>%
filter(year == 1982 | year == 1987) %>%
group_by(year) %>%
ct(reltrad, wt = oversamp)
## This is the weight for the rest of the sample ####
wtss <- gss %>%
View ab40.R
cces16 <- cces16 %>%
mutate(age = 2016 - birthyr) %>%
mutate(age2 = car::recode(age, "18:24 = '18-24'; 25:29 = '25-29'; 30:34 = '30-34'; 35:39 = '35-39'; 40:44 = '40-44'; 45:49 = '45-49'; 50:54 = '50-54'; 55:59 = '55-59'; 60:64 = '60-64'; 65:69 = '65-69'; 70:74 = '70-74'; 75:100 = '75+'")) %>%
mutate(male = car::recode(gender, "1=1; 2=0")) %>%
mutate(ab_imp = car::recode(CC16_301b, "5=1; 2=4; 3=3; 4=2; 5=1; else = NA")) %>%
mutate(ab1 = recode(CC16_332a, "2=0; 1=1; else = NA")) %>%
mutate(ab2 = recode(CC16_332c, "1=1; 2=0; else = NA")) %>%
mutate(ab3 = recode(CC16_332d, "1=1; 2=0; else = NA")) %>%
mutate(ab4 = recode(CC16_332e, "1=1; 2=0; else = NA")) %>%
mutate(ab5 = recode(CC16_332f, "1=1; 2=0; else = NA")) %>%
@ryanburge
ryanburge / pls_2033_32619.R
Last active Mar 26, 2019
PLS 2033 3/26/19.R
View pls_2033_32619.R
library(socsci)
library(car)
cces <- read_csv("https://raw.githubusercontent.com/ryanburge/cces/master/CCES%20for%20Methods/small_cces.csv")
## Here's a link to download the codebook
https://github.com/ryanburge/cces/raw/master/Codebooks/CCES_2016_Small_Codebook.pdf
## We are going to talk about two things today
1. The group_by() function
2. Confidence Intervals
@ryanburge
ryanburge / assignment_1.R
Last active Mar 19, 2019
First Assignment for 2033
View assignment_1.R
library(socsci)
library(car)
cces <- read_csv("https://raw.githubusercontent.com/ryanburge/cces/master/CCES%20for%20Methods/small_cces.csv")
## Here's a link to download the codebook
https://github.com/ryanburge/cces/raw/master/Codebooks/CCES_2016_Small_Codebook.pdf
##Here's a tutorial -- this might be helpful.
http://rpubs.com/ryanburge/grad_fall2018
@ryanburge
ryanburge / 2033_3_7_2019.R
Created Mar 7, 2019
Class Instructions for 3/7/2019
View 2033_3_7_2019.R
rstudio.cloud
log in!
Your dataset should already be loaded, but if not:
cces <- read_csv("https://raw.githubusercontent.com/ryanburge/cces/master/CCES%20for%20Methods/small_cces.csv")
Codebook is here:
https://github.com/ryanburge/cces/raw/master/Codebooks/CCES_2016_Small_Codebook.pdf
You can’t perform that action at this time.