Skip to content

Instantly share code, notes, and snippets.

Ryan Burge ryanburge

Block or report user

Report or block ryanburge

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View theme_gg
library(showtext)
theme_gg <- function(fff, base_size = 14, base_family = "font")
{
font_add_google(fff, "font")
showtext_auto()
theme_minimal() +
theme(legend.position = "none") +
@ryanburge
ryanburge / ba_caths.R
Created Jul 17, 2019
Born Again Catholics
View ba_caths.R
graph <- cces %>%
filter(religion == 2) %>%
mutate(ba = car::recode(pew_bornagain, "1=1; 2=0; else =NA")) %>%
group_by(year) %>%
mean_ci(ba, wt = weight)
graph %>%
ggplot(., aes(x = factor(year), y = mean, fill = mean)) +
geom_col(color = "black") +
View nones_political.R
## Mean Estimates ####
aa1 <- cces %>%
filter(none == 1) %>%
filter(year == 2008) %>%
filter(pid7 <= 7) %>%
group_by(state) %>%
mean_ci(pid7, wt = weight, ci = .84) %>%
mutate(year = 2008)
@ryanburge
ryanburge / cces_nones_maps.R
Last active Jul 8, 2019
CCES Counts Maps Nones
View cces_nones_maps.R
cces <- cces %>%
mutate(trad = frcode(evangelical == 1 ~ "Evangelical",
mainline == 1 ~ "Mainline",
bprot == 1 ~ "Black Protestant",
catholic == 1 ~ "Catholic",
jewish == 1 ~ "Jewish",
other == 1 ~ "Other Faith",
none == 1 ~ "No Religion",
TRUE ~ "Unclassified"))
@ryanburge
ryanburge / reltradv2.R
Created Jun 25, 2019
Reltrad Attempt.
View reltradv2.R
graph <- gss %>%
filter(year == 2018) %>%
mutate(reltrad = replace_na(reltrad, 0)) %>%
mutate(trad = frcode(other == 59 | other == 60 | other == 61 | other == 62 | other == 64 ~ "Mormon",
race == 2 & relig == 1 ~ "Black\nProt.",
reborn == 2 & relig == 1 ~ "Non-Evan.\nProtestant",
reborn == 1 & race == 3 ~ "Non-White\nEvangelical",
reborn == 1 & race == 1 ~ "White\nEvangelical",
reltrad == 4 ~ "Catholic",
@ryanburge
ryanburge / heat_maps_ed_att.R
Last active Jun 21, 2019
Education and Church Attendance Heat Maps
View heat_maps_ed_att.R
### White Evan Heat Map ####
graph <- cces18 %>%
filter(evangelical == 1) %>%
filter(race == 1) %>%
mutate(att = frcode(pew_churatd == 6 ~ "Never",
pew_churatd == 5 ~ "Seldom",
pew_churatd == 4 ~ "Yearly",
pew_churatd == 3 ~ "Monthly",
pew_churatd == 2 ~ "Weekly",
@ryanburge
ryanburge / polarized_abort.R
Last active Jun 10, 2019
Polarized Abortion
View polarized_abort.R
graph <- gss %>%
mutate(any = car::recode(abany, "1=1; 2=0; else = NA")) %>%
mutate(pid2 = car::recode(partyid, "0:2 = 'Democrat'; 4:6 = 'Republican'; else = NA")) %>%
group_by(year, pid2) %>%
mean_ci(any) %>%
na.omit()
graph %>%
ggplot(., aes(x = year, y = mean, group = pid2, color = pid2)) +
View atheist_therm.R
## Feeling Therms #####
anes12 <- read_dta("anes_timeseries_2012_Stata12.dta")
anes <- anes %>%
mutate(bagain = car::recode(V161263, "1=1; else=0")) %>%
mutate(prot = car::recode(anes$V161247a, "1=1; else =0")) %>%
mutate(baprot = bagain + prot) %>%
@ryanburge
ryanburge / djupe_woke.R
Last active May 25, 2019
VSG Blacks Deserve More or Less
View djupe_woke.R
graph <- tibble::tribble(
~bab, ~ba16f, ~mean, ~sd, ~n, ~level, ~se, ~lower, ~upper, ~year,
"No", "0", 1.997, 0.888342, 5586, 0.05, 0.011886, 1.974034, 2.020635, 2011,
"No", "1", 1.777, 0.935648, 328, 0.05, 0.051663, 1.675319, 1.878584, 2011,
"Yes", "0", 2.015, 0.969264, 234, 0.05, 0.063363, 1.890163, 2.139837, 2011,
"Yes", "1", 1.86, 0.890131, 1851, 0.05, 0.02069, 1.819295, 1.90045, 2011,
"No", "0", 2.273, 1.030418, 5586, 0.05, 0.013787, 2.246446, 2.300501, 2016,
"No", "1", 1.917, 1.012122, 328, 0.05, 0.055885, 1.806727, 2.026606, 2016,
"Yes", "0", 2.276, 1.071907, 234, 0.05, 0.070073, 2.137644, 2.413758, 2016,
"Yes", "1", 1.999, 0.999094, 1851, 0.05, 0.023222, 1.953852, 2.044941, 2016
@ryanburge
ryanburge / cces_interaction.R
Created May 22, 2019
CCES PolAct Interaction
View cces_interaction.R
cces16 <- cces16 %>%
mutate(att = recode(pew_churatd, "1=6; 2=5; 3=4; 4=3; 5=2; 6=1; else = NA")) %>%
mutate(college = car::recode(educ, "1:4=0; 5:6=1; else = NA")) %>%
mutate(meet = recode(CC16_417a_1, "1=1; else =0")) %>%
mutate(sign = recode(CC16_417a_2, "1=1; else =0")) %>%
mutate(vol = recode(CC16_417a_3, "1=1; else =0")) %>%
mutate(money = recode(CC16_417a_4, "1=1; else =0")) %>%
mutate(blood = recode(CC16_417a_5, "1=1; else =0")) %>%
mutate(activity = meet + sign + vol + money + blood) %>%
mutate(den = case_when(religpew == 1 & religpew_protestant !=3 ~ "Denom",
You can’t perform that action at this time.