View source: R/fbs_kcal_intake.R
fbs_kcal_intake | R Documentation |
This function calculates the amount served and eaten in kcal for the Food and Brain Study using food energy density and measured gram weights. This is done for all meals included in the study: standard meal + eating in the absence of hunger (EAH) (visits 1 and 7) and the portion size meals (visits 2-5). The kcal consumed will be calculated for each food item and total grams and kcal consumed will be calculated IF all food items for a meal were included in the dataset for a participant. If a participant has missing data, total consumed will not be calculated for them.
fbs_kcal_intake(intake_data, meal, parID)
intake_data |
a data.frame including grams consumed for each food item following the naming conventions described above |
meal |
string indicating which meals are included in intake_data: 'std_meal' - standard meal before EAH (visits 1 and 7); 'EAH' - eating in the absence of hunger paradigm (visits 1 and 7); and 'ps_meal' - portion size meal (visits 2-5) |
parID |
(optional) name of participant ID column in intake_data. If included the output dataset will be matched by parID, if not included the output dataset will be in the order of intake_data but will have no participant identifier. |
To use this function, the data must be prepared according to the following criteria: 1) The data must include the amount consumed for each food item individually 2) The amount consumed columns/variables must match the following naming conventions for each food item - 'consumed_food_g' where 'food' is replaced with each food item 3) The following foods must be included for each meal 3a) standard meal: 'applesauce', 'carrot', 'cheese_sndwch', 'cookies', 'ham_sndwch, 'milk', 'pbj_sndwch', 'potatochip', 'turkey_sndwch', 'ketchup', 'mayo', 'mustard', 3b) EAH: 'brownies', 'cornchips', 'hersheys', icecream', 'oreos', 'popcorn', 'pretzels', 'skittles', 'starbursts', 'water' 3c) portion size meals: 'chkn_nug', 'mac_cheese', 'grapes', broccoli', ketchup', water'
Note, as long as variable names match those listed, the dataset can include other variables
The intake_data data.frame with kcal consumed added for each food item and total consumed in grams and kcal.
For the Food and Brain Study, the energy density of each food is in fbs_ED.rda.
Raw data from Qualtrics was processed using the following scripts (or there 'lab' equivalent):
qualtrics_child_v1dat
, qualtrics_child_v2dat
, qualtrics_child_v3dat
, qualtrics_child_v4dat
, qualtrics_child_v5dat
, qualtrics_child_v7dat
# intake for standard meal
fbs_kcal_data <- fbs_kcal_intake(intake_data, meal = 'std_meal', parID = 'ID')
# intake for eah
fbs_kcal_data <- fbs_kcal_intake(intake_data, meal = 'EAH', parID = 'ID')
## Not run:
# no meal specified
fbs_kcal_data <- fbs_kcal_intake(intake_data, parID = 'ID')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.