Travis-CI Build Status CRAN_Status_Badge codecov


The goal of hei is to calculate Healthy Eating Index (HEI) scores from National Health and Nutrition Examination Survey (NHANES) data for use in dietary analyses. The HEI is a dietary metric designed by the USDA and NCI to gauge adherence to the US Dietary Guidelines.



Getting Started


The hei package contains one key function:

hei() takes as its arguments three data sets: an FPED data set, a NHANES dietary data set, and an NHANES demographic data set, returning a HEI score for each individual in the NHANES study being analyzed.

hei also includes get_fped() get_diet() and get_demo() for retrieving data from the Food Patterns Equivalents Database (FPED) and the NHANES dietary and demographic databases, respectively. The FPED data sets (in the public domain) retrieved by get_fped() are built into the package and have been converted to .csv files from the SAS data format in which they were originally published by their creators. get_diet() and get_demo() require the R package nhanesA which is employed to retrieve NHANES data sets directly from the web.

Related Work

hei is intended as a tool to aid in the analysis of NHANES data. It is important to be familiar with NHANES and its complex survey design as well as the FPED, which is derived from NHANES, before beginning any analyses involving the HEI.


hei is licensed under the GNU General Public License Version 3. Questions, feature requests and bug reports are welcome via the issue queue. The maintainer will review pull requests and incorporate contributions at his discretion.

Try the hei package in your browser

Any scripts or data that you put into this service are public.

hei documentation built on Aug. 18, 2017, 1:03 a.m.