diet_score_fun: Diet score

Description Usage Arguments Details Examples

View source: R/diet.R

Description

This function creates a derived diet variable (diet_score) 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.

Usage

1
diet_score_fun(FVCDFRU, FVCDSAL, FVCDPOT, FVCDCAR, FVCDVEG, FVCDJUI, DHH_SEX)

Arguments

FVCDFRU

daily consumption of fruit

FVCDSAL

daily consumption of green salad

FVCDPOT

daily consumption of potatoes

FVCDCAR

daily consumption of carrots

FVCDVEG

daily consumption of other vegetables

FVCDJUI

daily consumption of fruit juice

DHH_SEX

sex; 1 = male, 2 = female

Details

While diet score can be calculated for all survey respondents, in the 2005 CCHS survey cycle, fruit and vegetable consumption was an optional section in which certain provinces had opted in to be asked to respondents. In this survey cycle, fruit and vegetable consumption was asked to respondents in British Columbia, Ontario, Alberta, and Prince Edward Island. As such, diet score has a large number of missing respondents for this cycle.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Using the 'diet_score_fun' function to create the derived diet variable  
# across CCHS cycles.
# diet_score_fun() is specified in the variable_details.csv

# To create a harmonized diet_score variable across CCHS cycles, use 
# rec_with_table() for each CCHS cycle and specify diet_score_fun and the
# required base variables.
# Using merge_rec_data(), you can combine smoke_simple across cycles

library(cchsflow)

diet_score2009_2010 <- rec_with_table(
  cchs2009_2010_p, c(
    "FVCDFRU", "FVCDSAL", "FVCDPOT", "FVCDCAR", "FVCDVEG", "FVCDJUI", 
    "DHH_SEX", "diet_score_fun"
  )
)

head(diet_score2009_2010)

diet_score2011_2012 <- rec_with_table(
  cchs2011_2012_p,c(
    "FVCDFRU", "FVCDSAL", "FVCDPOT", "FVCDCAR", "FVCDVEG", "FVCDJUI", 
    "DHH_SEX", "diet_score_fun"
  )
)

tail(diet_score2011_2012)

combined_diet_score <- suppressWarnings(merge_rec_data(diet_score2009_2010,
 diet_score2011_2012))

head(combined_diet_score)
tail(combined_diet_score)

cchsflow documentation built on June 24, 2021, 1:07 a.m.