Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ryanburge/cf4e54867ed132c1602ebb3de7babde5 to your computer and use it in GitHub Desktop.
Save ryanburge/cf4e54867ed132c1602ebb3de7babde5 to your computer and use it in GitHub Desktop.
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)
gg %>%
mutate(lab = round(pct, 2)) %>%
ggplot(., aes(x = fct_rev(gd), y = pct, fill = gd)) +
geom_col(color = "black") +
coord_flip() +
y_pct() +
scale_fill_paletteer_d("ggthemes::Classic_Blue_Red_6")+
geom_text(aes(y = pct + .008, label = paste0(lab*100, '%')), position = position_dodge(width = .9), size = 5, family = "font") +
theme_rb() +
labs(x = "", y = "", title = "What Do You Believe About God? Among Those Who Never Attend Services", caption = "@ryanburge\nData: GSS 2021") +
save("never_att_belief.png", ht = 4)
gg <- cces20 %>%
mutate(aa = case_when(religpew == 9 | religpew == 10 ~ 1, TRUE ~ 0)) %>%
cces_attend(pew_churatd) %>%
group_by(att) %>%
mean_ci(aa, wt = commonweight) %>%
filter(att != "NA")
gg %>%
ggplot(., aes(x = att, y = mean, fill = att)) +
geom_col(color = "black") +
geom_text(aes(y = mean + .008, label = paste0(mean*100, '%')), position = position_dodge(width = .9), size = 5, family = "font") +
y_pct() +
scale_fill_gdocs() +
theme_rb() +
labs(x = "", y = "", title = "Share Who Say They Are Atheist or Agnostic", caption = "@ryanburge\nData: CES 2020") +
save("ath_agn_attend.png", wd = 4.75)
# https://gist.github.com/cf4e54867ed132c1602ebb3de7babde5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment