Last active
May 24, 2023 07:41
-
-
Save JosepER/a99f5f7a208e53b1bfecfa50a439d6bf 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
library(tidyverse) | |
# Exercise 1 | |
years <- c("08", "10", "14", "16") | |
# append all IT datasets from 2008 to 2016 | |
it_df <- purrr::map_dfr(.x = years, | |
.f = ~read.LIS(glue::glue("it{.x}p"), vars = c("year", "educlev", "educ_c", "enroll", "sex", "age" ))) | |
table(it_df$educlev, it_df$educ_c) | |
# Exercise 2 | |
years <- c(1991:2019) | |
years <-str_sub(years, 3, 4) | |
de_df <- purrr::map_dfr(.x = years, | |
.f = function(x) { | |
left_join(read.LIS(glue::glue("de{x}p"), | |
vars = c("hid", "year", "pi11", "educlev", "educ_c", "enroll", "sex", "age" )), | |
read.LIS(glue::glue("de{x}h"), | |
vars = c("hid", "year" )), | |
by = c("year", "hid")) | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment