Created
January 3, 2023 15:51
-
-
Save ryanburge/4c3a76834bfa16c761e06e5b13a8b63b to your computer and use it in GitHub Desktop.
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
ttt1 <- gss %>% | |
gss_reltrad6(reltrad) %>% | |
filter(year >= 1986 & year <= 2018) %>% | |
mutate(liv = posslq) %>% | |
mutate(liv = frcode(liv == 1 ~ "Married, Living w/Spouse", | |
liv == 2 ~ "Not Married, Living Together", | |
liv == 3 ~ "Have Partner, Don't Live Together", | |
liv == 4 ~ "No Steay Partner")) %>% | |
group_by(year, reltrad) %>% | |
ct(liv, wt = wtssall, show_na = FALSE) | |
ttt2 <- gss %>% | |
gss_reltrad6(reltrad) %>% | |
filter(year == 2021) %>% | |
mutate(liv = posslq) %>% | |
mutate(liv = frcode(liv == 1 ~ "Married, Living w/Spouse", | |
liv == 2 ~ "Not Married, Living Together", | |
liv == 3 ~ "Have Partner, Don't Live Together", | |
liv == 4 ~ "No Steay Partner")) %>% | |
group_by(year, reltrad) %>% | |
ct(liv, wt = wtssnrps, show_na = FALSE) | |
aaa1 <- gss %>% | |
filter(age <= 40) %>% | |
mutate(pid7 = partyid + 1) %>% | |
cces_pid3(pid7) %>% | |
filter(year >= 1986 & year <= 2018) %>% | |
mutate(liv = posslq) %>% | |
mutate(liv = frcode(liv == 1 ~ "Married, Living w/Spouse", | |
liv == 2 ~ "Not Married, Living Together", | |
liv == 3 ~ "Have Partner, Don't Live Together", | |
liv == 4 ~ "No Steady Partner")) %>% | |
group_by(year, pid3) %>% | |
ct(liv, wt = wtssall, show_na = FALSE) %>% | |
filter(pid3 != "NA") | |
aaa2 <- gss %>% | |
filter(age <= 40) %>% | |
mutate(pid7 = partyid + 1) %>% | |
cces_pid3(pid7) %>% | |
filter(year == 2021) %>% | |
mutate(liv = posslq) %>% | |
mutate(liv = frcode(liv == 1 ~ "Married, Living w/Spouse", | |
liv == 2 ~ "Not Married, Living Together", | |
liv == 3 ~ "Have Partner, Don't Live Together", | |
liv == 4 ~ "No Steady Partner")) %>% | |
group_by(year, pid3) %>% | |
ct(liv, wt = wtssnrps, show_na = FALSE) %>% | |
filter(pid3 != "NA") | |
graph <- bind_rows(aaa1, aaa2) | |
graph %>% | |
filter(year >= 2000) %>% | |
ggplot(., aes(x = year, y = pct, color = pid3, group = pid3)) + | |
geom_point(stroke = 1, shape = 21, alpha = .45) + | |
geom_smooth(se = FALSE) + | |
facet_wrap(~ liv) + | |
pid3_color() + | |
scale_y_continuous(labels = percent, limits = c(0, .62)) + | |
theme_rb(legend = TRUE) + | |
labs(x = "Year", y = "", title = "Describe Your Living/Partner Situation", caption = "@ryanburge\nGSS 2000-2021") | |
save("living_wspouse.png", ht = 8) | |
# https://gist.github.com/4c3a76834bfa16c761e06e5b13a8b63b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment