This function creates a categorical derived variable (HWTGBMI_der_cat4) that categorizes derived BMI (HWTGBMI_der).

bmi_fun_cat(HWTGBMI_der)

Arguments

HWTGBMI_der

derived variable that calculates numeric value for BMI. See bmi_fun for documentation on how variable was derived.

Value

value for BMI categories in the HWTGBMI_der_cat4 variable.

Details

The categories were based on international standards and are divided into four categories: underweight for BMI < 18.5 (1), normal weight for BMI between 18.5 to 25 (2), overweight for BMI between 25 to 30 (3), and obese for BMI over 30 (4).

HWTGBMI_der_cat4 uses the derived variable HWTGBMI_der. HWTGBMI_der uses height and weight that have been transformed by cchsflow. In order to categorize BMI across CCHS cycles, height and weight variables must be transformed and harmonized.

Examples

 
# 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"
  )
)
#> No variable_details detected.
#>               Loading cchsflow variable_details
#> Using the passed data variable name as database_name
#> NOTE for HWTGHTM: Height is a reported in meters from 2005 CCHS onwards

head(bmi_cat_2009_2010)
#>   HWTGHTM HWTGWTK HWTGBMI_der HWTGBMI_der_cat4
#> 1   1.778   54.45    17.22401                1
#> 2   1.702   56.00    19.33165                2
#> 3   1.626   90.00    34.04093                4
#> 4      NA      NA          NA            NA(b)
#> 5   1.880   99.00    28.01041                3
#> 6   1.575   72.00    29.02494                3

bmi_cat_2011_2012 <- rec_with_table(
  cchs2011_2012_p,c(
    "HWTGHTM",
    "HWTGWTK",
    "HWTGBMI_der",
    "HWTGBMI_der_cat4"
  )
)
#> No variable_details detected.
#>               Loading cchsflow variable_details
#> Using the passed data variable name as database_name
#> NOTE for HWTGHTM: Height is a reported in meters from 2005 CCHS onwards

tail(bmi_cat_2011_2012)
#>     HWTGHTM HWTGWTK HWTGBMI_der HWTGBMI_der_cat4
#> 195   1.600   64.35    25.13672                3
#> 196   1.880   80.10    22.66297                2
#> 197   1.753   78.75    25.62635                3
#> 198   1.651   83.70    30.70657                4
#> 199   1.930   74.25    19.93342                2
#> 200   1.575   76.50    30.83900                4

combined_bmi_cat <- suppressWarnings(merge_rec_data
(bmi_cat_2009_2010,bmi_cat_2011_2012))

head(combined_bmi_cat)
#>   HWTGHTM HWTGWTK HWTGBMI_der HWTGBMI_der_cat4
#> 1   1.778   54.45    17.22401                1
#> 2   1.702   56.00    19.33165                2
#> 3   1.626   90.00    34.04093                4
#> 4      NA      NA          NA            NA(b)
#> 5   1.880   99.00    28.01041                3
#> 6   1.575   72.00    29.02494                3
tail(combined_bmi_cat)
#>     HWTGHTM HWTGWTK HWTGBMI_der HWTGBMI_der_cat4
#> 395   1.600   64.35    25.13672                3
#> 396   1.880   80.10    22.66297                2
#> 397   1.753   78.75    25.62635                3
#> 398   1.651   83.70    30.70657                4
#> 399   1.930   74.25    19.93342                2
#> 400   1.575   76.50    30.83900                4