Last active
June 12, 2020 13:41
-
-
Save ryanburge/25a8b5084dfc5f19f3dbee6570e396c7 to your computer and use it in GitHub Desktop.
Counting Religious Groups in the GSS
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
## Read the data in as gss | |
## This a specific survey weight to use for just 1982 and 1987 because they oversampled African-Americans ### | |
over <- gss %>% | |
filter(year == 1982 | year == 1987) %>% | |
group_by(year) %>% | |
ct(reltrad, wt = oversamp) | |
## This is the weight for the rest of the sample #### | |
wtss <- gss %>% | |
group_by(year) %>% | |
ct(reltrad, wt = wtssall) | |
##Removing the two years that used the overweight #### | |
wtss <- wtss %>% | |
filter(year != 1982) %>% | |
filter(year != 1987) | |
## Bind them both together #### | |
graph <- bind_rows(over, wtss) | |
## Graph #### | |
graph %>% | |
ggplot(., aes(x = year, y = pct, color = factor(reltrad))) + | |
geom_point() + | |
geom_line() + | |
scale_y_continuous(labels = percent) + | |
theme_gg("Abel") + | |
scale_color_npg() + | |
labs(x = "", y = "Percent of Population", title = "America's Changing Religious Landscape", caption = "Data: GSS 1972-2018") + | |
annotate("text", x=1996, y = .30, label = "Evangelical", size = 4, family = "font") + | |
annotate("text", x=1995.75, y = .225, label = "Catholic", size = 4, family = "font") + | |
annotate("text", x=2012, y = .119, label = "Mainline", size = 4, family = "font") + | |
annotate("text", x=2013, y = .175, label = "No Religion", size = 4, family = "font") + | |
annotate("text", x=2006, y = .092, label = "Black Protestant", size = 4, family = "font") + | |
annotate("text", x=1999.5, y = .068, label = "Other Faith", size = 4, family = "font") + | |
annotate("text", x=2005, y = .0275, label = "Jewish", size = 4, family = "font") + | |
ggsave("D://cces/images/full_reltrad_gss.png", width = 7) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment