# NOT RUN {
# Using immigration_fun() to create immigration_der values across CCHS cycles
# immigration_fun() is specified in variable_details.csv along with the
# CCHS variables and cycles included.
# To transform immigration_der, use rec_with_table() for each CCHS cycle
# and specify immigration_der, along with the various SDC variables.
# Then by using merge_rec_data() you can combine immigration_der across cycles.
library(cchsflow)
immigration2001 <- rec_with_table(
cchs2001_p, c(
"SDCFIMM", "SDCGCBG", "SDCGCGT", "SDCGRES", "immigration_der"
)
)
head(immigration2001)
immigration2009_2010 <- rec_with_table(
cchs2009_2010_p, c(
"SDCFIMM", "SDCGCBG", "SDCGCGT", "SDCGRES", "immigration_der"
)
)
tail(immigration2009_2010)
combined_immigration <- merge_rec_data(immigration2001, immigration2009_2010)
head(combined_immigration)
tail(combined_immigration)
# }
Run the code above in your browser using DataLab