Skip to content

Instantly share code, notes, and snippets.

View ryanburge's full-sized avatar

Ryan Burge ryanburge

View GitHub Profile
@ryanburge
ryanburge / grad_methods_1023.R
Created October 18, 2023 20:55
Graduate Class for 10/18/2023
# install.packages("remotes")
# library(remotes)
# remotes::install_github("ryanburge/socsci")
# library(socsci)
cces20 <- read_csv("https://www.dropbox.com/s/wuixmc67ae786wp/small_ces2020.csv?dl=1")
Codebook is here: https://www.dropbox.com/s/s01kefaks4u6g1f/small_ces2020%20Codebook.docx?dl=0
@ryanburge
ryanburge / lucy_example.R
Last active March 22, 2023 20:33
Lucy Example
coef_names <- c("Education" = "educ",
"Age" = "age",
"Male" = "male",
"Income" = "inc",
"White" = "white",
"Attendance" = "att",
"South" = "south",
"Immigrant/First Gen." = "imm",
"Political Liberal" = "con")
Each question has four multiple choice response options + not sure or refused
Which Bible figure is most closely associated with leading the Exodus from Egypt?
Which Bible figure is most closely associated with killing an enemy by slinging a stone?
According to the Christian Gospels, who delivered the Sermon on the Mount?
What is an atheist?
What is an agnostic?
Which of the following is NOT one of the Ten Commandments?
Which of the following best describes the Jewish holiday of Rosh Hashanah?
@ryanburge
ryanburge / mainline_conservative.R
Created September 9, 2019 20:40
Mainline Conservatives
pid_fun <- function(df, denom, num, name){
denom <- enquo(denom)
df %>%
mutate(pid3 = frcode(pid7 == 1 | pid7 == 2 | pid7 == 3 ~ "Democrat",
pid7 == 4 ~ "Independent",
pid7 == 5 | pid7 == 6 | pid7 == 7 ~ "Republican")) %>%
filter(!! denom == num) %>%
ct(pid3, wt = commonweight, show_na = FALSE) %>%
ttt1 <- gss %>%
gss_reltrad6(reltrad) %>%
filter(year >= 1986 & year <= 2018) %>%
mutate(liv = posslq) %>%
mutate(liv = frcode(liv == 1 ~ "Married, Living w/Spouse",
liv == 2 ~ "Not Married, Living Together",
liv == 3 ~ "Have Partner, Don't Live Together",
liv == 4 ~ "No Steay Partner")) %>%
group_by(year, reltrad) %>%
ct(liv, wt = wtssall, show_na = FALSE)
## Packages ##
library(socsci)
library(car)
install.packages("jtools")
library(jtools)
install.packages("interactions")
library(interactions)
REGRESSION TUTORIAL: https://rpubs.com/ryanburge/reg_interact
@ryanburge
ryanburge / regression_grad_methods_2022.R
Created November 30, 2022 16:32
Regression Class - Graduate Methods - 11/30/2022
# install.packages("jtools")
# install.packages("interactions")
# install.packages("ggstance")
# install.packages("broom.mixed")
library(jtools)
library(interactions)
library(ggstance)
library(broom.mixed)
library(socsci)
@ryanburge
ryanburge / fall_2022_coding_assignment1.R
Last active November 9, 2022 23:30
Coding Assignment #1 - Fall 2022 Graduate Methods
## Read your data in with this line:
gss <- read_csv("https://raw.githubusercontent.com/ryanburge/ct/master/gss_small.csv", guess_max = 25000)
## Codebook:
https://gssdataexplorer.norc.org/
## Fu Ad Wumpaeh Alhassan
1. What percentage of people supported access to a legal abortion in the case of rape in 1994?
2. How many white women did not finish high school in the 1972 sample?
@ryanburge
ryanburge / 11022022.R
Created November 2, 2022 20:42
PLS 5053 - Grad Methods - 11/2/2022
Read your data in with this line:
gss <- read_csv("https://raw.githubusercontent.com/ryanburge/ct/master/gss_small.csv", guess_max = 25000)
Codebook: https://gssdataexplorer.norc.org/
@ryanburge
ryanburge / Code_DAY_ONE.R
Created October 19, 2022 23:06
Code from Day One
cces20 %>% ct(gender)
## THIS IS A COMMENT
cces20 %>% ct(race)
## HOW MANY 25 YEAR OLDS ####