Created
February 27, 2026 05:14
-
-
Save acbass49/5914acaf05ecb3d8283ac453781ab6de to your computer and use it in GitHub Desktop.
Are LDS More Likely To Travel?
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
| library(tidyverse) | |
| library(haven) | |
| library(clipr) | |
| data <- read_sav("./data/atp/ATP W124.sav") | |
| data$COUNTRIES_VISITED_W124 | |
| data$F_RELIG | |
| nrow(data) | |
| data |> | |
| count(F_RELIG) | |
| data |> | |
| filter(!is.na(WANT_TRAVEL_W124)) |> | |
| count(F_RELIG) | |
| data |> | |
| count(WANT_TRAVEL_W124, wt = WEIGHT_W124) |> | |
| drop_na() |> | |
| mutate(prop = n / sum(n)) | |
| data |> | |
| filter(F_RELIG %in% c(1,2,3,9,10,11,12)) |> | |
| group_by(F_RELIG) |> | |
| count(WANT_TRAVEL_W124, wt = WEIGHT_W124) |> | |
| drop_na() |> | |
| mutate( | |
| prop = n / sum(n) | |
| ) |> | |
| select(-n) |> | |
| pivot_wider(names_from = F_RELIG, values_from = prop) | |
| clipr::write_clip( | |
| data |> | |
| count(COUNTRIES_VISITED_W124, wt = WEIGHT_W124) |> | |
| mutate(prop = n / sum(n)) | |
| ) | |
| clipr::write_clip( | |
| data |> | |
| filter(F_RELIG %in% c(1,2,3,9,10,11,12)) |> | |
| group_by(F_RELIG) |> | |
| count(COUNTRIES_VISITED_W124, wt = WEIGHT_W124) |> | |
| drop_na() |> | |
| mutate( | |
| prop = n / sum(n) | |
| ) |> | |
| select(-n) |> | |
| pivot_wider(names_from = F_RELIG, values_from = prop) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment