This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Figure 11.1 #### | |
era <- range_speedread("https://docs.google.com/spreadsheets/d/15Yjcs8tFDyvcqaWw9cPmFIKBuRwqLPnB17VsKhFccJA/edit?usp=sharing") | |
era <- era %>% mutate(ratified = as.factor(ratified)) | |
era <- era %>% | |
mutate(fill = frcode(ratified == "1972" ~ "1972", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gg <- ns %>% | |
mutate(educ = frcode(education <= 3 ~ "Some HS", | |
education == 4 ~ "HS Grad", | |
education == 5 ~ "Trade School", | |
education == 6 ~ "Some College", | |
education == 7 ~ "2 Yr.", | |
education == 8 ~ "4 Yr.", | |
education == 9 ~ "Some Grad.", | |
education == 10 ~ "Masters", | |
education == 11 ~ "Doctorate")) %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ggg1 <- cces08 %>% | |
filter(V215 == 1) %>% | |
cces_race(race) %>% | |
mutate(vote = CC410) %>% | |
mutate(vote = frcode(vote == 1 ~ "Republican", | |
vote == 2 ~ "Democrat", | |
vote == 3 | vote == 4 | vote == 5 | vote == 6 ~ "Third Party")) %>% | |
group_by(race) %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Figure 6 - Ideological Space #### | |
fun <- function(df, var1, var2, var3, weight, yr) { | |
aaa1 <- df %>% | |
filter({{var1}} <= 7) %>% | |
mean_ci({{var1}}, wt = {{weight}}) %>% | |
mutate(year = yr) %>% | |
mutate(group = "Yourself") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gg <- gss %>% | |
filter(year == 2021) %>% | |
filter(attend == 0) %>% | |
mutate(gd = frcode(god == 1 ~ "Don't Believe", | |
god == 2 ~ "No Way to Find Out", | |
god == 3 ~ "Some Higher Power", | |
god == 4 ~ "Believe Sometimes", | |
god == 5 ~ "Believe But Doubts", | |
god == 6 ~ "Believe No Doubts")) %>% | |
ct(gd, wt = wtssnrps, show_na = FALSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cces20 %>% | |
filter(pid7 == 5 | pid7 == 6 | pid7 == 7) %>% | |
cces_trad(religpew) %>% | |
ct(trad2, wt = commonweight, show = FALSE) | |
# https://gist.github.com/130761c3a2108c816482553e393134e4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aa <- cces %>% | |
mutate(ev = case_when(pew_bornagain == 1 ~ 1, | |
pew_bornagain == 2 ~ 0)) %>% | |
filter(year == 2010 | year == 2020) %>% | |
group_by(birthyr, year) %>% | |
mean_ci(ev, wt = weight, ci = .84) | |
aa <- aa %>% | |
mutate(cohorts = frcode(birthyr >= 1919 & birthyr <= 1928 ~ "1925-1929", | |
birthyr >= 1929 & birthyr <= 1938 ~ "1930-1934", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Five statements - response options range from Strongly Agree to Strongly Disagree | |
25 = Most Christian Nationalism | |
5 = Least | |
1. The federal government should declare the United States a Christian nation | |
2. The federal government should advocate Christian values | |
3. The federal government should enforce strict separation of church and state | |
4. The success of the United States is part of Gods plan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install.packages("jtools") | |
install.packages("interactions") | |
install.packages("ggstance") | |
install.packages("broom.mixed") | |
library(jtools) | |
library(interactions) | |
library(ggstance) | |
library(broom.mixed) | |
library(socsci) |