This function creates a categorical derived diet variable (diet_score_cat3) that categorizes derived diet score (diet_score).
diet_score_fun_cat(diet_score)
diet_score | derived variable that calculates diet score.
See |
---|
value for diet score categories using diet_score_cat3 variable.
The diet score is based on consumption of fruit, salad, potatoes, carrots, other vegetables and juice. 2 baseline points plus summation of total points for diet attributes. Negative overall scores are recoded to 0, resulting in a range from 0 to 10.The categories were based on the Mortality Population Risk Tool (Douglas Manuel et al. 2016).
diet_score_cat3 uses the derived variable diet_score. diet_score uses sex, and fruit and vegetable variables that have been transformed by cchsflow (see documentation on diet_score). In order to categorize diet across CCHS cycles, sex, and fruit and vegetable variables must be transformed and harmonized.
# Using the diet_score_fun_cat function to categorize the derived diet # variable across CCHS cycles. # diet_score_fun_cat() is specified in the variable_details.csv. # To create a harmonized diet_score_cat3 variable across CCHS cycles, use # rec_with_table() for each CCHS cycle. # Since diet_score is also a derived variable, you will have to specify # the variables that are derived from it. # Using merge_rec_data(), you can combine diet_score_cat3 across cycles. library(cchsflow) diet_score_cat2009_2010 <- rec_with_table( cchs2009_2010_p, c( "FVCDFRU", "FVCDSAL", "FVCDPOT", "FVCDCAR", "FVCDVEG", "FVCDJUI", "DHH_SEX", "diet_score", "diet_score_cat3" ) )#>#>#>#>#>#>#>#>#>#>#>#> DHH_SEX FVCDCAR FVCDFRU FVCDJUI FVCDPOT FVCDSAL FVCDVEG diet_score #> 1 2 0.1 4.0 4.0 0.1 0.3 4 4.0 #> 2 2 0.1 1.0 0.1 0.1 0.4 2 5.6 #> 3 2 0.1 0.1 1.0 0.0 0.3 1 3.5 #> 4 1 NA NA NA NA NA NA NA #> 5 1 0.4 0.6 1.0 0.4 0.1 6 9.5 #> 6 2 0.3 1.0 0.0 0.3 0.3 1 4.9 #> diet_score_cat3 #> 1 2 #> 2 2 #> 3 2 #> 4 NA(b) #> 5 3 #> 6 2diet_score_cat2011_2012 <- rec_with_table( cchs2011_2012_p,c( "FVCDFRU", "FVCDSAL", "FVCDPOT", "FVCDCAR", "FVCDVEG", "FVCDJUI", "DHH_SEX", "diet_score", "diet_score_cat3" ) )#>#>#>#>#>#>#>#>#>#>#>#> DHH_SEX FVCDCAR FVCDFRU FVCDJUI FVCDPOT FVCDSAL FVCDVEG diet_score #> 195 1 0.1 1.0 0.1 0.1 1.0 1.0 5.2 #> 196 1 0.0 0.4 0.7 0.3 0.0 0.4 1.1 #> 197 1 0.1 0.1 1.0 0.6 0.3 0.7 3.8 #> 198 2 0.1 1.0 0.3 0.1 0.4 0.4 4.0 #> 199 1 1.0 1.0 0.1 1.0 0.3 1.0 4.3 #> 200 2 0.3 2.0 0.0 0.6 0.4 4.0 9.3 #> diet_score_cat3 #> 195 2 #> 196 1 #> 197 2 #> 198 2 #> 199 2 #> 200 3combined_diet_score_cat <- suppressWarnings(merge_rec_data( diet_score_cat2009_2010, diet_score_cat2011_2012)) head(combined_diet_score_cat)#> DHH_SEX FVCDCAR FVCDFRU FVCDJUI FVCDPOT FVCDSAL FVCDVEG diet_score #> 1 2 0.1 4.0 4.0 0.1 0.3 4 4.0 #> 2 2 0.1 1.0 0.1 0.1 0.4 2 5.6 #> 3 2 0.1 0.1 1.0 0.0 0.3 1 3.5 #> 4 1 NA NA NA NA NA NA NA #> 5 1 0.4 0.6 1.0 0.4 0.1 6 9.5 #> 6 2 0.3 1.0 0.0 0.3 0.3 1 4.9 #> diet_score_cat3 #> 1 2 #> 2 2 #> 3 2 #> 4 NA(b) #> 5 3 #> 6 2#> DHH_SEX FVCDCAR FVCDFRU FVCDJUI FVCDPOT FVCDSAL FVCDVEG diet_score #> 395 1 0.1 1.0 0.1 0.1 1.0 1.0 5.2 #> 396 1 0.0 0.4 0.7 0.3 0.0 0.4 1.1 #> 397 1 0.1 0.1 1.0 0.6 0.3 0.7 3.8 #> 398 2 0.1 1.0 0.3 0.1 0.4 0.4 4.0 #> 399 1 1.0 1.0 0.1 1.0 0.3 1.0 4.3 #> 400 2 0.3 2.0 0.0 0.6 0.4 4.0 9.3 #> diet_score_cat3 #> 395 2 #> 396 1 #> 397 2 #> 398 2 #> 399 2 #> 400 3