soepis_igene_long <- rio::import(here::here("data/soepis_igene_long.rds"))
soepis_igene_age <- rio::import(here::here("data/soepis_igene_age.rds"))
pid_igene_sample <- rio::import(here::here("data/pid_igene_sample.rds"))
# soepisv36 <- rio::import(here::here("../../data/00_raw/SOEP/SOEP_v36/Wagner/SOEP-IS2019_P.rds"))
First you can see the number of available observation for each variable in each year
soepis_igene_long %>%
filter(key_category == "ID's") %>%
drop_na(value) %>%
tabyl(syear, key) %>% adorn_totals(where = "col") %>% tbl_df()
# alternative version for blog?
# soepis_igene_long %>%
# filter(key_category == "ID's") %>%
# drop_na(value) %>%
# group_by(key, syear) %>%
# count() %>%
# pivot_wider(names_from = key, values_from = n)
soepis_igene_long %>%
filter(key_category == "Survey") %>%
drop_na(value) %>%
tabyl(key_name_label, syear) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_long %>%
filter(key_category == "Demography") %>%
drop_na(value) %>%
tabyl(key_name_label, syear) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_long %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "b5_")) %>%
tabyl(key_name_label, syear) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_long %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "cogtest")) %>%
tabyl(key_name_label, syear) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_long %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "forgive_")) %>%
tabyl(key_name_label, syear) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_long %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "iabaut")) %>%
tabyl(key_name_label, syear) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_long %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "optimism|selfworth|trust")) %>%
tabyl(key_name_label, syear) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_long %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "iabm")) %>%
tabyl(key_name_label, syear) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_long %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "recip")) %>%
tabyl(key_name_label, syear) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_long %>%
drop_na(value) %>%
filter(key_category == "Other") %>%
tabyl(key_name_label, syear) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_age %>%
filter(key_category == "ID's") %>%
drop_na(value) %>%
tabyl(age_k, key) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_age %>%
filter(key_category == "Survey") %>%
drop_na(value) %>%
tabyl(key_name_label, age_k) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_age %>%
filter(key_category == "Demography") %>%
drop_na(value) %>%
tabyl(key_name_label, age_k) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_age %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "b5_")) %>%
tabyl(key_name_label, age_k) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_age %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "cogtest")) %>%
tabyl(key_name_label, age_k) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_age %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "forgive_")) %>%
tabyl(key_name_label, age_k) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_age %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "iabaut")) %>%
tabyl(key_name_label, age_k) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_age %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "optimism|selfworth|trust")) %>%
tabyl(key_name_label, age_k) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_age %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "iabm")) %>%
tabyl(key_name_label, age_k) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_age %>%
drop_na(value) %>%
filter(key_category == "Psych. Measure",
str_detect(key, "recip_")) %>%
tabyl(key_name_label, age_k) %>% adorn_totals(where = "col") %>% tbl_df()
soepis_igene_age %>%
drop_na(value) %>%
filter(key_category == "Other") %>%
tabyl(key_name_label, age_k) %>% adorn_totals(where = "col") %>% tbl_df()