# NOT RUN {
# Using bmi_fun_cat() to categorize BMI across CCHS cycles
# bmi_fun_cat() is specified in variable_details.csv along with the
# CCHS variables and cycles included.
# To transform HWTGBMI_der_cat4 across all cycles, use rec_with_table() for
# each CCHS cycle.
# Since HWTGBMI_der is also a derived variable, you will have to specify
# the variables that are derived from it.
library(cchsflow)
bmi_cat_2009_2010 <- rec_with_table(
cchs2009_2010_p, c(
"HWTGHTM",
"HWTGWTK",
"HWTGBMI_der",
"HWTGBMI_der_cat4"
)
)
head(bmi_cat_2009_2010)
bmi_cat_2011_2012 <- rec_with_table(
cchs2011_2012_p,c(
"HWTGHTM",
"HWTGWTK",
"HWTGBMI_der",
"HWTGBMI_der_cat4"
)
)
tail(bmi_cat_2011_2012)
combined_bmi_cat <- suppressWarnings(merge_rec_data
(bmi_cat_2009_2010,bmi_cat_2011_2012))
head(combined_bmi_cat)
tail(combined_bmi_cat)
# }
Run the code above in your browser using DataLab