Raised Nones
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
## Raised Nones Over Time #### | |
graph1 <- gss %>% | |
mutate(none16 = car::recode(relig16, "4=1; 1:3=0; 5:13=0; else = NA")) %>% | |
group_by(year) %>% | |
mean_ci(none16, wt = wtssall) %>% | |
mutate(type = "Raised None") | |
graph2 <- gss %>% | |
group_by(year) %>% | |
mean_ci(nofaith, wt = wtssall) %>% | |
mutate(type = "Adult None") | |
graph <- bind_rows(graph1, graph2) | |
graph %>% | |
ggplot(., aes(x= year, y = mean, color = type, group = type)) + | |
geom_point() + | |
geom_line() + | |
geom_ribbon(aes(ymin = lower, ymax = upper, fill = type, color = type), alpha = .2) + | |
scale_y_continuous(labels = percent) + | |
scale_fill_simpsons() + | |
scale_color_simpsons() + | |
theme_gg("Abel") + | |
labs(x = "", y = "Percent of the Population", title = "More People are Being Raised Nones", caption = "@ryanburge\nData: GSS 1972-2018") + | |
annotate("text", x=2002, y = .16, label = "Adult None", size = 4, family = "font") + | |
annotate("text", x=2010, y = .105, label = "Raised None", size = 4, family = "font") + | |
ggsave("E://raised_none_line.png", type = "cairo-png") | |
## Average Age of Nones #### | |
ttt1 <- gss %>% | |
filter(nofaith ==1) %>% | |
group_by(year) %>% | |
mean_ci(age, wt = wtssall) %>% | |
mutate(type = "Nones Age") | |
ttt2 <- gss %>% | |
group_by(year) %>% | |
mean_ci(age, wt = wtssall) %>% | |
mutate(type = "All Age") | |
graph <- bind_rows(ttt1, ttt2) | |
graph %>% | |
ggplot(., aes(x= year, y = mean, color = type, group = type)) + | |
geom_point() + | |
geom_line() + | |
geom_ribbon(aes(ymin = lower, ymax = upper, fill = type, color = type), alpha = .2) + | |
scale_fill_simpsons() + | |
scale_color_simpsons() + | |
geom_segment(aes(x = 1980, y = 34.7, xend = 1980, yend = 43.6), color = "black", linetype = "dashed") + | |
geom_segment(aes(x = 2010, y = 41.4, xend = 2010, yend = 46.6), color = "black", linetype = "dashed") + | |
annotate("text", x=1981.9, y = 39, label = "8.9\nYears", size = 4, family = "font") + | |
annotate("text", x=2011.9, y = 44.5, label = "5.2\nYears", size = 4, family = "font") + | |
annotate("text", x=2003, y = 46, label = "Entire Sample", size = 4, family = "font") + | |
annotate("text", x=2000, y = 40, label = "Nones", size = 4, family = "font") + | |
theme_gg("Abel") + | |
labs(x = "", y = "Average Age", title = "The Average Age of Nones Compared to the Population", caption = "@ryanburge\nData: GSS 1972-2018") + | |
ggsave("E://age_nones_pop.png", type = "cairo-png") | |
## Raised Nones Over Time #### | |
gss %>% | |
mutate(none16 = car::recode(relig16, "4=1; 1:3=0; 5:13=0; else = NA")) %>% | |
filter(year == 2018) %>% | |
filter(none16 ==1) %>% | |
ct(relig) | |
parts <- c(`None`= 13, `Protestant`= 5 , `Catholic`= 1, `All Other` = 1) | |
w1 <- waffle(parts, legend_pos = "bottom", rows = 4) + | |
theme_gg("Abel") + | |
theme(axis.text.x = element_blank()) + | |
theme(axis.text.y = element_blank()) + | |
theme(legend.position = "bottom") + | |
scale_color_simpsons() + | |
scale_fill_simpsons() + | |
labs(x = "", y = "", title = "People Raised as Nones - Adult Tradition", subtitle = "1 Square = 5 Percent", caption = "@ryanburge\nData: GSS 2018") + | |
ggsave("E://none_waffle.png") | |
gss %>% | |
filter(year == 2018) %>% | |
filter(relig16 ==1) %>% | |
ct(relig) | |
parts <- c(`None`= 3 , `Protestant`= 15 , `Catholic`= 1, `All Other` = 1) | |
w2 <- waffle(parts, legend_pos = "bottom", rows = 4) + | |
theme_gg("Abel") + | |
theme(axis.text.x = element_blank()) + | |
theme(axis.text.y = element_blank()) + | |
theme(legend.position = "bottom") + | |
scale_color_simpsons() + | |
scale_fill_simpsons() + | |
labs(x = "", y = "", title = "People Raised as Protestants - Adult Tradition", subtitle = "1 Square = 5 Percent", caption = "@ryanburge\nData: GSS 2018") + | |
ggsave("E://protestant_waffle.png") | |
gss %>% | |
filter(year == 2018) %>% | |
filter(relig16 ==2) %>% | |
ct(relig) | |
parts <- c(`None`= 4 , `Protestant`= 3 , `Catholic`= 12, `All Other` = 1) | |
w3 <- waffle(parts, legend_pos = "bottom", rows = 4) + | |
theme_gg("Abel") + | |
theme(axis.text.x = element_blank()) + | |
theme(axis.text.y = element_blank()) + | |
theme(legend.position = "bottom") + | |
scale_color_simpsons() + | |
scale_fill_simpsons() + | |
labs(x = "", y = "", title = "People Raised as Catholics - Adult Tradition", subtitle = "1 Square = 5 Percent", caption = "@ryanburge\nData: GSS 2018") + | |
ggsave("E://cath_waffle.png") | |
gss %>% | |
filter(year == 2018) %>% | |
mutate(other = car::recode(relig16, "1=0; 2=0; 4=0; 3=1; 5:13=1; else = NA")) %>% | |
filter(other ==1) %>% | |
ct(relig) | |
parts <- c(`None`= 5 , `Protestant`= 2 , `Catholic`= 1, `All Other` = 12) | |
w4 <- waffle(parts, legend_pos = "bottom", rows = 4) + | |
theme_gg("Abel") + | |
theme(axis.text.x = element_blank()) + | |
theme(axis.text.y = element_blank()) + | |
theme(legend.position = "bottom") + | |
scale_color_simpsons() + | |
scale_fill_simpsons() + | |
labs(x = "", y = "", title = "People Raised as Others - Adult Tradition", subtitle = "1 Square = 5 Percent", caption = "@ryanburge\nData: GSS 2018") + | |
ggsave("E://other_waffle.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment