Created
February 25, 2026 18:35
-
-
Save ryanburge/bc5d9e4dd1ce88067f3eb48204320182 to your computer and use it in GitHub Desktop.
CCES 2024 - Race and Religion
This file contains hidden or 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
| cces24 %>% | |
| + mutate( | |
| + vote = case_when(CC24_410 == 1 ~ "Democrat", | |
| + CC24_410 == 2 ~ "Republican", | |
| + CC24_410 == 4 ~ "Third Party"), | |
| + christian = religpew %in% 1:4, | |
| + white_christian = religpew %in% 1:4 & race == 1, | |
| + nonreligious = religpew %in% 9:11 | |
| + ) %>% | |
| + filter(!is.na(vote)) %>% | |
| + group_by(vote) %>% | |
| + summarise( | |
| + pct_white_christian = weighted.mean(white_christian, commonweight, na.rm = TRUE), | |
| + pct_christian = weighted.mean(christian, commonweight, na.rm = TRUE), | |
| + pct_nonreligious = weighted.mean(nonreligious, commonweight, na.rm = TRUE) | |
| + ) | |
| # A tibble: 3 × 4 | |
| vote pct_white_christian pct_christian pct_nonreligious | |
| <chr> <dbl> <dbl> <dbl> | |
| 1 Democrat 0.253 0.422 0.450 | |
| 2 Republican 0.603 0.712 0.177 | |
| 3 Third Party 0.270 0.356 0.464 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment