# NOT RUN {
# Using the SPS_5_fun function to create the derived SPS5_der variable
# across CCHS cycles.
# SPS_5_fun() is specified in the variable_details.csv.
# To create a harmonized SPS5_der variable across CCHS cycles, use
# rec_with_table() for each CCHS cycle and specify SPS_5_fun and the
# required base variables.
# Using merge_rec_data(), you can combine SPS5_der across cycles.
library(cchsflow)
SPS5_2011_2012 <- rec_with_table(
cchs2011_2012_p, c(
"SPS_03", "SPS_04", "SPS_05", "SPS_07", "SPS_10", "SPS5_der"
)
)
head(SPS5_2011_2012)
SPS5_2017_2018 <- rec_with_table(
cchs2017_2018_p,c(
"SPS_03", "SPS_04", "SPS_05", "SPS_07", "SPS_10", "SPS5_der"
)
)
tail(SPS5_2017_2018)
combined_SPS5 <- suppressWarnings(merge_rec_data(SPS5_2011_2012,
SPS5_2017_2018))
head(combined_SPS5)
tail(combined_SPS5)
# }
Run the code above in your browser using DataLab