Skip to content

zxucmu/dietaryindexNDP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

The R package 'dietaryindexNDP' (dietaryindex NHANES DII PLUS) provides a comprehensive set of tools to calculate the Dietary Inflammation Index (DII) using data from the National Health and Nutrition Examination Survey (NHANES). This vignette will guide you through the functionality of the package, demonstrating how to utilize its various functions for dietary analysis and inflammation index calculation.

Citaions

Please cite the following two publications when using this R package in your research:

1. Z. Xu, Improving the dietaryindex R Package: A Proposal to Include Additional Components for More Accurate DII Computation in NHANES, The American Journal of Clinical Nutrition, https://doi.org/10.1016/j.ajcnut.2024.10.023.

2. J.J. Zhan, R.A. Hodge, A.L. Dunlop, M.M. Lee, L. Bui, D. Liang, E.P. Ferranti, Dietaryindex: A User-Friendly and Versatile R Package for Standardizing Dietary Pattern Analysis in Epidemiological and Clinical Studies, The American Journal of Clinical Nutrition, https://doi.org/10.1016/j.ajcnut.2024.08.021.

Before You Get Started

1. Installation

There are several methods to install the R package. Below are two options for installing this package:

1.1 Online Installation from GitHub: You can install the package directly from GitHub using the following command:

install.packages('devtools')

devtools::install_github("zxucmu/dietaryindexNDP", ref = "dietaryindexNDP_1.0.0")

1.2 Offline Installation from a ZIP File: Alternatively, you can install the package offline by downloading the ZIP file from GitHub (https://github.com/zxucmu/dietaryindexNDP/tree/dietaryindexNDP_1.0.0), without unzipping it, place it into the working directory, and use the following command:

install.packages('devtools')

devtools::install_local(path = './dietaryindexNDP-dietaryindexNDP_1.0.0.zip')

2. Loading

Please load this package before using it.

library(dietaryindexNDP)

How to Use This Package

The calculation of the DII consists of three steps:

1. The first step is flattening a FNDDSSRLinks or FNDDSIngred file.

2. The second step involves calculating the intakes of garlic, ginger, onion, pepper, thyme and oregano, as well as isoflavones, anthocyanidins, flavan-3-ols, flavanones, flavones and flavonols for specific NHANES survey periods.

3. In the third step, the DII is calculated based on components such as alcohol, vitamins (B12, B6, A, C, D, E), β-carotene, caffeine, carbohydrates, cholesterol, energy, fiber, folic acid, iron, magnesium, monounsaturated fatty acids (MUFA), niacin, n-6 fatty acids, protein, polyunsaturated fatty acids (PUFA), riboflavin, saturated fat, selenium, thiamin, zinc, garlic, ginger, onion, pepper, thyme, and oregano. It is also advisable to include isoflavones, anthocyanidins, flavan-3-ols, flavanones, flavones, and flavonols for participants of NHANES 2007-2008, 2009-2010 or 2017-2018.

1. Flattening a FNDDSSRLinks or FNDDSIngred File

The purpose of flattening a FNDDSSRLinks or FNDDSIngred file for a specific version of the USDA Food and Nutrient Database for Dietary Studies (FNDDS) is to ensure that all FNDDS food codes are linked to their corresponding SR/Ingredient codes. To use this function, you need to specify the path to a FNDDS file or pass an already imported dataframe from the FNDDSSRLinks or FNDDSIngred tables.

Here are two examples showing how to use this function:

Example 1: Provide a Path to a FNDDS File

In this example, a file path for a FNDDS file in Microsoft Access® format (.mdb) is provided. The file names should be formatted like: FNDDS.mdb, FNDDS_2017-2018.mdb, etc. To facilitate understanding, researchers can download the sample data file named FNDDS4.mdb from here{.uri} and place it in your working directory.

Thus, the function illustrated in this example is:

FNDDSSRLinks_flattened_0708 <- FNDDSSRLinks_FNDDSIngred_flattened(FNDDS_PATH = './FNDDS4.mdb')

To obtain other FNDDS files, please refer to the following link: http://www.ars.usda.gov/ba/bhnrc/fsrg

Example 2: Flattening an Imported DataFrame

Alternatively, this function will flatten data that has already been imported as a dataframe.

In this second example, suppose FNDDSIngred_1718 is a dataframe that has already been imported into the Global Environment from the table named FNDDSIngred within the FNDDS_2017-2018.mdb file.

# You can also access 'FNDDSIngred_1718' from the preloaded dataset in the R package.

FNDDSIngred_1718 <- dietaryindexNDP::EXAMPLE(FILE = 'FNDDSIngred_1718')

Thus, the function illustrated in this example is:

FNDDSIngred_flattened_1718 <- FNDDSSRLinks_FNDDSIngred_flattened(FNDDS_PATH = FNDDSIngred_1718)

Value:

This function will generate a dataframe that flattens the FNDDSSRLinks/FNDDSIngred file for a specified FNDDS version.

2. Calculating the Intakes of Garlic and Other Additional Components

2.1 Calculating the Intake of Garlic, Ginger, Onion, Pepper, Thyme and Oregano Separately

The calculation for the intake of garlic, ginger, onion, pepper, thyme, and oregano are similar; therefore, we will provide a detailed explanation using garlic as an example.

To calculate the garlic component within the DII, the function DII_GARLIC_INTAKE() requires three inputs:

  • FLATTENED_FILEPATH: A flattened FNDDSSRLinks or FNDDSIngred file, generated by the FNDDSSRLinks_FNDDSIngred_flattened() in step 1.

  • DR1IFF_PATH: The path or pre-imported dataframe for the Day 1 Individual Foods File (DR1IFF), which contains dietary intake data for NHANES participants.

  • DR2IFF_PATH: Optionally, the path or dataframe for the Day 2 Individual Foods File (DR2IFF), when available.

The function DII_GARLIC_INTAKE() calculates the total garlic intake for each participant based on the recipes that are detailed in the supplementary file titled 'Recipes used to calculate the intakes of garlic, ginger, onion, pepper, thyme, and oregano.xlsx' (download here{.uri}).

Here are some examples showing how to use this function:

Example 1: Provide a Path to a DR1IFF or DR2IFF File

In this example, a file path for a DR1IFF_E.XPT or DR2IFF_E.XPT file is provided. To facilitate understanding, researchers can download the sample data file named FNDDS4.mdb, DR1IFF_E.XPT and DR2IFF_E.XPT from here{.uri} and place it in your working directory.

# fnddsSRlinks_4.1_flattened is a dataframe generated by:

fnddsSRlinks_4.1_flattened <- FNDDSSRLinks_FNDDSIngred_flattened(FNDDS = './FNDDS4.mdb')
# You can also access this data from the preloaded dataset in the R package.

fnddsSRlinks_4.1_flattened <- dietaryindexNDP::EXAMPLE(FILE = 'fnddsSRlinks_4.1_flattened')

Thus, the function illustrated in this example is:

# For example purposes, the files DR1IFF_E.XPT and DR2IFF_E.XPT only include participants with SEQN 41475, 41476, and 41477, which helps reduce computation time.

garlic.e <- dietaryindexNDP::DII_GARLIC_INTAKE(FLATTENED_FILEPATH = fnddsSRlinks_4.1_flattened, 
                                               DR1IFF_PATH = './DR1IFF_E.XPT', 
                                               DR2IFF_PATH = './DR2IFF_E.XPT')

Example 2: DR1IFF or DR2IFF as an Imported DataFrame

In this second example, suppose dr1iff.e and dr2iff.e are dataframes that have already been imported into the Global Environment from the DR1IFF_E.XPT and DR2IFF_E.XPT files.

# dr1iff.e and dr2iff.e are dataframes imported from DR1IFF_E.XPT and DR2IFF_E.XPT. For example purposes, dr1iff.e and dr2iff.e only include participants with SEQN 41475, 41476, and 41477, which helps reduce computation time.

install.packages('haven')

library('haven')

dr1iff.e <- haven::read_xpt(file = './DR1IFF_E.XPT')

dr2iff.e <- haven::read_xpt(file = './DR2IFF_E.XPT')
# You can also access these two dataframes from the preloaded dataset in the R package.

dr1iff.e <- dietaryindexNDP::EXAMPLE(FILE = 'dr1iff.e')

dr2iff.e <- dietaryindexNDP::EXAMPLE(FILE = 'dr2iff.e')

Thus, the function illustrated in this example is:

garlic.e <- dietaryindexNDP::DII_GARLIC_INTAKE(FLATTENED_FILEPATH = fnddsSRlinks_4.1_flattened, 
                                               DR1IFF_PATH = dr1iff.e, 
                                               DR2IFF_PATH = dr2iff.e)

Example 3: Calculating the Intake of Garlic for Either Day 1 or Day 2

In this second example, suppose dr1iff.e is a dataframe that has already been imported into the Global Environment from the DR1IFF_E.XPT file. Researchers can download the sample data file named DR2IFF_E.XPT from here{.uri} and place it in your working directory.

# Day 1

garlic.e.day1 <- dietaryindexNDP::DII_GARLIC_INTAKE(FLATTENED_FILEPATH = fnddsSRlinks_4.1_flattened, 
                                                    DR1IFF_PATH = dr1iff.e)

# Day 2

garlic.e.day2 <- dietaryindexNDP::DII_GARLIC_INTAKE(FLATTENED_FILEPATH = fnddsSRlinks_4.1_flattened, 
                                                    DR2IFF_PATH = './DR2IFF_E.XPT')

Example 4: Calculating the Intake of Garlic for NHANES 2001-2002

Since there is only dietary intake data of one day included in NHANES 2001-2002, the garlic consumption is calculated based solely on the file pointed to by DR1IFF_PATH when both DR1IFF_PATH and DR2IFF_PATH lead to the same file. To facilitate understanding, researchers can download the sample data file named DRXIFF_B.XPT from here{.uri} and place it in your working directory.

# The following three examples will yield identical results

fnddsSRlinks_1.0_flattened <- dietaryindexNDP::EXAMPLE(FILE = 'fnddsSRlinks_1.0_flattened')

# For example purposes, the file DRXIFF_B.XPT only include participants with SEQN 1, 2, and 3, which helps reduce computation time.

garlic.a <- dietaryindexNDP::DII_GARLIC_INTAKE(FLATTENED_FILEPATH = fnddsSRlinks_1.0_flattened, 
                                               DR1IFF_PATH = './DRXIFF_B.XPT')

# Suppose drxiff.b is a dataframe that has already been imported into the Global Environment from the file. For example purposes, drxiff.b only include participants with SEQN 1, 2, and 3, which helps reduce computation time.

drxiff.b <- dietaryindexNDP::EXAMPLE(FILE = 'drxiff.b')

garlic.a <- dietaryindexNDP::DII_GARLIC_INTAKE(FLATTENED_FILEPATH = fnddsSRlinks_1.0_flattened, 
                                               DR2IFF_PATH = drxiff.b)

garlic.a <- dietaryindexNDP::DII_GARLIC_INTAKE(FLATTENED_FILEPATH = fnddsSRlinks_1.0_flattened, 
                                               DR1IFF_PATH = drxiff.b, 
                                               DR2IFF_PATH = './DRXIFF_B.XPT')

Value:

The output is a dataframe that includes the variable SEQN (the unique identifier for each NHANES participant) and garlic intake variables (DR1TGARLIC for Day 1 and/or DR2TGARLIC for Day 2). If data from the DRXIFF files are used, the output will include the variable DRXTGARLIC.

Important Considerations:

It should be noted that the calculation of the garlic component within the DII applies specifically to the NHANES 2001-2020 period. However, NHANES 1999-2000 is not recommended due to the absence of an FNDDS file for that survey period.

Calculating the Intake of Ginger, Onion, Pepper, Thyme and Oregano:

Just as the DII_GARLIC_INTAKE() function calculates garlic intake, the DII_GINGER_INTAKE(), DII_ONION_INTAKE(), DII_PEPPER_INTAKE(), DII_THYME_INTAKE(), and DII_OREGANO_INTAKE() functions calculate the intake of ginger, onion, pepper, thyme, and oregano, respectively.

2.2 Calculating the Intakes of Various Flavonoids

The intake of flavonoids within the DII can be calculated for participants from NHANES 2007-2010 and 2017-2018 using the DII_FLAV_INTAKE() function. This function computes the intake of six major flavonoid subgroups: flavan-3-ols, flavones, flavonols, flavonones, anthocyanidins, and isoflavones, based on the data provided for Day 1 and Day 2 dietary intake files.

To perform this calculation, the user must provide the file paths for the flavonoid intake data files from NHANES, formatted as flav_dr1tot_0710.sas7bdat for Day 1 and flav_dr2tot_0710.sas7bdat for Day 2. Alternatively, these files can be preloaded as dataframes in the Global Environment if they have already been imported from corresponding files like flav_dr1tot_1718.sas7bdat or flav_dr2tot_1718.sas7bdat.

Here are some examples demonstrating how to calculate flavonoid intake using Day 1 or Day 2 files:

Example 1: Provide a Path to a flav_dr1tot_0710.sas7bdat or flav_dr2tot_0710.sas7bdat File

In this example, a file path for a flav_dr1tot_0710.sas7bdat or flav_dr2tot_0710.sas7bdat file is provided. To facilitate understanding, researchers can download the sample data file named flav_dr1tot_0710.sas7bdat and flav_dr2tot_0710.sas7bdat from here{.uri} and place it in your working directory.

Thus, the function illustrated in this example is:

# Using both Day 1 and Day 2 intake data for the period 2007-2010.

flav_0710 <- DII_FLAV_INTAKE(FLAV_DR1TOT_PATH = './flav_dr1tot_0710.sas7bdat', 
                             FLAV_DR2TOT_PATH = './flav_dr2tot_0710.sas7bdat')

Example 2: Calculate the Intake Using Only Day 1 Data

Alternatively, you can calculate the intake using only Day 1 data.

# Using only Day 1 data for the period 2007-2010.

flav_0710_day1 <- DII_FLAV_INTAKE(FLAV_DR1TOT_PATH = './flav_dr1tot_0710.sas7bdat')

Example 3: Calculate the Intake Using Only Day 2 Data

If the data for Day 2 is already imported as a dataframe, the function can be called directly:

# Using Day 2 data already imported into the Global Environment.

flav_dr2tot_0710 <- dietaryindexNDP::EXAMPLE(FILE = 'flav_dr2tot_0710')

flav_0710_day2 <- DII_FLAV_INTAKE(FLAV_DR2TOT_PATH = flav_dr2tot_0710)

Example 4: flav_dr1tot_0710 or flav_dr2tot_0710 as an Imported DataFrame

In this second example, suppose flav_dr1tot_0710 and flav_dr2tot_0710 are dataframes that have already been imported into the Global Environment from the flav_dr1tot_0710.sas7bdat and flav_dr2tot_0710.sas7bdat. Researchers can also download the sample data file named flav_dr1tot_0710.sas7bdat and flav_dr2tot_0710.sas7bdat from here{.uri} and place it in your working directory.

# flav_dr1tot_0710 and flav_dr2tot_0710 are dataframes imported from:

install.packages('haven')

library('haven')

flav_dr1tot_0710 <- haven::read_sas(data_file = './flav_dr1tot_0710.sas7bdat')

flav_dr2tot_0710 <- haven::read_sas(data_file = './flav_dr2tot_0710.sas7bdat')
# You can also access these two dataframes from the preloaded dataset in the R package.

flav_dr1tot_0710 <- dietaryindexNDP::EXAMPLE(FILE = 'flav_dr1tot_0710')

flav_dr2tot_0710 <- dietaryindexNDP::EXAMPLE(FILE = 'flav_dr2tot_0710')

Thus, the function illustrated in this example is:

flav_0710 <- DII_FLAV_INTAKE(FLAV_DR1TOT_PATH = flav_dr1tot_0710, 
                             FLAV_DR2TOT_PATH = flav_dr2tot_0710)

The following one is also acceptable:

flav_0710 <- DII_FLAV_INTAKE(FLAV_DR1TOT_PATH = './flav_dr1tot_0710.sas7bdat', 
                             FLAV_DR2TOT_PATH = flav_dr2tot_0710)

Value:

This function returns a dataframe that includes the participant identifier (SEQN) and their flavonoid intakes for Day 1, Day 2, or both days, depending on the available data. Each flavonoid subgroup will be reported as separate variables, allowing researchers to assess specific intake levels for each participant.

2.3 Calculating the Intakes of Garlic, Ginger, Onion, Pepper, Thyme, Oregano and Various Flavonoids within the DII in One Step

The DII_ONESTEP_INTAKE() function enables the efficient calculation of several dietary components related to the DII in one comprehensive step. This function is designed to calculate the intakes of garlic, ginger, onion, pepper, and thyme/oregano for NHANES participants from the 2001-2020 period, as well as flavonoids (flavan-3-ols, flavones, flavonols, flavanones, anthocyanidins, and isoflavones) for the NHANES 2007-2010 and 2017-2018 cycles.

To use the DII_ONESTEP_INTAKE() function, the following input parameters are required:

  • FLATTENED_FILEPATH: A dataframe generated by the FNDDSSRLinks_FNDDSIngred_flattened() function, which flattens the FNDDSSRLinks/FNDDSIngred file for the appropriate FNDDS version.

  • DR1IFF_PATH and DR2IFF_PATH: These parameters represent the file paths for the Individual Foods Files for Day 1 and Day 2, respectively. The filenames should follow the format DR1IFF_E.XPT, DR2IFF_B.XPT, or similar, depending on the NHANES cycle. Alternatively, pre-imported dataframes in the Global Environment can be used.

  • FLAV_DR1TOT_PATH and FLAV_DR2TOT_PATH: These are the file paths for the Flavonoid Intake Data Files for Day 1 and Day 2. The files should be named in formats like flav_dr1tot_0710.sas7bdat, flav_dr2tot_1718.sas7bdat, or the data can be provided as pre-imported dataframes from files like flav_dr1tot_0710.sas7bdat or flav_dr2tot_1718.sas7bdat.

Here are several examples illustrating the use of the DII_ONESTEP_INTAKE() function across different NHANES cycles:

Example 1: Using both Day 1 and Day 2 Intake Data (NHANES 2007-2010)

To facilitate understanding of this example, researchers can download the sample data file named DR1IFF_E.XPT, DR2IFF_E.XPT, flav_dr1tot_0708.sas7bdat and flav_dr2tot_0708.sas7bdat from here and place it in your working directory.

fnddsSRlinks_4.1_flattened <- dietaryindexNDP::EXAMPLE(FILE = 'fnddsSRlinks_4.1_flattened')

# add.comp.onestep: additional component onestep

# For example purposes, the files DR1IFF_E.XPT and DR2IFF_E.XPT only include participants with SEQN 41475, 41476, and 41477, which helps reduce computation time.

add.comp.onestep <- DII_ONESTEP_INTAKE(FLATTENED_FILEPATH = fnddsSRlinks_4.1_flattened,
                                       DR1IFF_PATH = './DR1IFF_E.XPT',
                                       DR2IFF_PATH = './DR2IFF_E.XPT',
                                       FLAV_DR1TOT_PATH = './flav_dr1tot_0708.sas7bdat',
                                       FLAV_DR2TOT_PATH = './flav_dr2tot_0708.sas7bdat')

Example 2: Using Only Day 1 Intake Data (NHANES 2013-2014)

To facilitate understanding of this example, researchers can download the sample data file named DR1IFF_H.XPT from here{.uri} and place it in your working directory.

fnddsSRlinks_1314_flattened <- dietaryindexNDP::EXAMPLE('fnddsSRlinks_1314_flattened')

# For example purposes, the file DR1IFF_H.XPT only include participants with SEQN 73557, 73558, and 73559, which helps reduce computation time.

add.comp.onestep <- DII_ONESTEP_INTAKE(FLATTENED_FILEPATH = fnddsSRlinks_1314_flattened,
                                       DR1IFF_PATH = './DR1IFF_H.XPT')

Example 3: Using Only Day 2 Intake Data (NHANES 2015-2016)

To facilitate understanding of this example, researchers can download the sample data file named DR2IFF_I.XPT from here{.uri} and place it in your working directory.

fnddsIngred_1516_flattened <- dietaryindexNDP::EXAMPLE('fnddsIngred_1516_flattened')

# For example purposes, the file DR2IFF_I.XPT only include participants with SEQN 83732, 83733, and 83734, which helps reduce computation time.

add.comp.onestep <- DII_ONESTEP_INTAKE(FLATTENED_FILEPATH = fnddsIngred_1516_flattened,
                                       DR2IFF_PATH = './DR2IFF_I.XPT')

Example 4: Using Pre-imported Dataframes (NHANES 2001-2002)

fnddsSRlinks_1.0_flattened <- dietaryindexNDP::EXAMPLE('fnddsSRlinks_1.0_flattened')

# For example purposes, drxiff.b only include participants with SEQN 1, 2, and 3, which helps reduce computation time.

drxiff.b <- dietaryindexNDP::EXAMPLE('drxiff.b')

add.comp.onestep <- DII_ONESTEP_INTAKE(FLATTENED_FILEPATH = fnddsSRlinks_1.0_flattened,
                                       DR1IFF_PATH = drxiff.b)

Value:

The function returns a dataframe that includes the SEQN (participant identifier) along with the calculated intakes for garlic, ginger, onion, pepper, thyme/oregano, and flavonoids (isoflavones, anthocyanidins, flavan-3-ols, flavanones, flavones, and flavonols) for Day 1, Day 2, or both days. This comprehensive dataset allows for a streamlined analysis of these key dietary components within the DII.

Important Considerations:
The calculation of garlic, ginger, onion, pepper, and thyme/oregano intakes is not recommended for the NHANES 1999-2000 cycle due to the absence of the FNDDS (Food and Nutrient Database for Dietary Studies) file for that survey period.

The calculation of garlic, ginger, onion, pepper, thyme, oregano, isoflavones, anthocyanidins, flavan-3-ols, flavanones, flavones and flavonols intakes within the DII framework is expected to be time-consuming. To expedite the process, these intakes have been pre-calculated. Researchers can access this dietary data directly using the DII_ONESTEP_INTAKE_RESULT() function, as described in detail in Section 2.4.

2.4 Retrieving Pre-computed Results for Additional Components in DII Calculation

The DII_ONESTEP_INTAKE_RESULT() function provides a seamless way to extract dietary components that have already been computed within the DII framework. This function allows researchers to quickly access additional dietary components related to DII, without the need for recalculating the full intake data. The function supports data extraction for both individual and combined days, ensuring flexibility based on the research design.

To efficiently retrieve the desired results, the function requires two key input parameters:

  • NHANESCycle: This parameter takes a character string that specifies the NHANES cycle of interest (e.g., "0102", "0304"). The cycle indicates the specific survey period from which the dietary data will be extracted.

  • DAY: This parameter specifies which day's results to retrieve. It accepts three values:

    • 'first' for Day 1 data,

    • 'second' for Day 2 data,

    • 'both' for retrieving results from both days.

Here are some typical use cases demonstrating how the DII_ONESTEP_INTAKE_RESULT() function can be applied across different NHANES cycles:

# Retrieving pre-computed results for the NHANES 2011-2012 cycle for Day 1:

add.comp.onestep <- DII_ONESTEP_INTAKE_RESULT(NHANESCycle = "1112", DAY = "first")
# Retrieving results for both days in the NHANES 2003-2004 cycle:

add.comp.onestep <- DII_ONESTEP_INTAKE_RESULT(NHANESCycle = "0304", DAY = "both")
# Extracting results for NHANES 2001-2002:

add.comp.onestep <- DII_ONESTEP_INTAKE_RESULT(NHANESCycle = "0102", DAY = "second")

Value:

The function returns a dataframe containing the additional DII components for the specified NHANES cycle. If the requested NHANES cycle is not found, the function will return an error message, prompting the researcher to recheck the cycle designation.

This output can be directly integrated into further statistical analysis or used to complement other dietary data for a more comprehensive evaluation of participants' inflammatory dietary exposures.

3. Incorporating Above Additional Components to Calculate the DII

The DII_NHANES_CALCULATION() function builds on the established DII_NHANES_FPED() function from the dietaryindex R package. It extends the standard DII calculation by incorporating additional dietary components, such as garlic, ginger, onion, pepper, and oregano/thyme, along with flavonoids, in addition to the components used in the DII_NHANES_FPED() for NHANES participants.

This function is highly flexible, allowing researchers to input different datasets from multiple NHANES cycles and select specific combinations of data for Day 1, Day 2, or both days of dietary intake. 

To execute the DII_NHANES_CALCULATION() function, the following key parameters are required:

  • FPED_PATH: The file path for the total Food Patterns Equivalents Intakes per Individual for Day 1. It should be formatted like fped_dr1tot_0708.sas7bdat, pyr_tot.sas7bdat, etc. Alternatively, it can be a dataframe already imported into the R Global Environment from such files.

  • NUTRIENT_PATH: The file path for the total Nutrient Intakes file for Day 1 (e.g., DR1TOT_J.XPT). This can also be provided as a pre-loaded dataframe.

  • DEMO_PATH: The file path for the NHANES Demographic data file, following standard NHANES naming conventions (e.g., DEMO_J.XPT).

  • FPED_PATH2: The file path for Day 2 Food Patterns Equivalents Intakes per Individual, if available. The naming format mirrors Day 1 files (e.g., fped_dr2tot_0708.sas7bdat).

  • NUTRIENT_PATH2: The file path for the total Nutrient Intakes for Day 2, similarly formatted to Day 1 (e.g., DR2TOT_J.XPT).

  • OTHER_INGREDIENTS: A dataframe generated by the DII_ONESTEP_INTAKE() function. This dataframe includes the SEQN (participant ID) and the intakes of garlic, ginger, onion, pepper, oregano, thyme, and various flavonoids for the relevant NHANES cycle and day(s) of intake. The inclusion of these additional dietary components is what differentiates this function from the DII_NHANES_FPED() function in the dietaryindex R package, allowing a more nuanced assessment of the dietary-inflammatory relationship.

Here is an example illustrating the use of the DII_NHANES_CALCULATION() function:

Suppose we aim to calculate the DII for participants in the NHANES 2007-2008 cycle, using both Day 1 and Day 2 dietary data. To facilitate understanding, researchers can download the sample data file named fped_dr1tot_0708.sas7bdat, fped_dr2tot_0708.sas7bdat, DR1TOT_E.XPT, DR2TOT_E.XPT and DEMO_E.XPT from here{.uri} and place it in your working directory.

other_ingredients.e <- dietaryindexNDP::DII_ONESTEP_INTAKE_RESULT(NHANESCycle = '0708', DAY = 'both')

dii_0708 <- DII_NHANES_CALCULATION(FPED_PATH = 'fped_dr1tot_0708.sas7bdat',
                                   NUTRIENT_PATH = 'DR1TOT_E.XPT',
                                   DEMO_PATH = 'DEMO_E.XPT',
                                   FPED_PATH2 = 'fped_dr2tot_0708.sas7bdat',
                                   NUTRIENT_PATH2 = 'DR2TOT_E.XPT',
                                   OTHER_INGREDIENTS = other_ingredients.e)

Value:

The output of the DII_NHANES_CALCULATION() function is a dataframe containing the DII and its component scores. DII is the total score, which represents the sum of all components. While DII_NOETOH is the DII score excluding alcohol.

4. DII_NHANES_PLUS(): Integrating the Above Three Steps to Calculate the DII in One Step

The DII_NHANES_PLUS() function provides an efficient method and reduces the complexity of the DII calculation by combining multiple data processing steps into a single operation, thus improving usability and ensuring comprehensive analysis. With a single function call, users can integrate dietary data from different sources, such as food patterns, nutrient intakes, demographic data and flavonoids consumption across two days of intake when applicable.

Key Parameters:

  • FPED_PATH and FPED_PATH2: File paths or dataframes for the total Food Patterns Equivalents Intakes (Day 1 and Day 2).

  • NUTRIENT_PATH and NUTRIENT_PATH2: File paths or dataframes for total Nutrient Intakes (Day 1 and Day 2).

  • DEMO_PATH: File path or dataframe for demographic data.

  • FNDDS_PATH: File path or dataframe for the FNDDS file in Microsoft Access® format.

  • DR1IFF_PATH and DR2IFF_PATH: File paths or dataframes for Individual Foods Files (Day 1 and Day 2).

  • FLAV_DR1TOT_PATH and FLAV_DR2TOT_PATH: File paths or dataframes for Flavonoid Intake Data Files (Day 1 and Day 2).

Here is an example illustrating the use of the DII_NHANES_PLUS() function:

Suppose we aim to calculate the DII for participants in the NHANES 2007-2008 cycle, using both Day 1 and Day 2 dietary data. To facilitate understanding, researchers can download the sample data file named fped_dr1tot_0708.sas7bdat, fped_dr2tot_0708.sas7bdat, DR1TOT_E.XPT, DR2TOT_E.XPT, DR1IFF_E.XPT, DEMO_E.XPT, FNDDS4.mdb, DR2IFF_E.XPT, flav_dr1tot_0708.sas7bdat, and flav_dr2tot_0708.sas7bdat from here{.uri} and place it in your working directory.

# For example purposes, the files DR1IFF_E.XPT and DR2IFF_E.XPT only include participants with SEQN 41475, 41476, and 41477, which helps reduce computation time.

dii_0708 <- DII_NHANES_PLUS(FPED_PATH = './fped_dr1tot_0708.sas7bdat',
                            NUTRIENT_PATH = './DR1TOT_E.XPT',
                            DEMO_PATH = './DEMO_E.XPT',
                            FPED_PATH2 = './fped_dr2tot_0708.sas7bdat',
                            NUTRIENT_PATH2 = './DR2TOT_E.XPT',
                            FNDDS_PATH = './FNDDS4.mdb',
                            DR1IFF_PATH = './DR1IFF_E.XPT',
                            DR2IFF_PATH = './DR2IFF_E.XPT',
                            FLAV_DR1TOT_PATH = './flav_dr1tot_0708.sas7bdat',
                            FLAV_DR2TOT_PATH = './flav_dr2tot_0708.sas7bdat')

Value:

The function returns a dataframe containing the DII and its component scores.

5. DII_NHANES_PLUS_RESULT(): Retrieving Precomputed DII Results

The DII_NHANES_PLUS_RESULT() function offers a streamlined and efficient approach for researchers looking to access precomputed Dietary Inflammatory Index (DII) values for specific NHANES cycles. This function is particularly useful when recalculating DII values is unnecessary or when computational resources need to be optimized. By simply specifying the desired NHANES cycle and day of dietary intake, researchers can instantly retrieve the DII results, including its components, without the need to rerun calculations.

Key Parameters:

  • NHANESCycle: This parameter requires a character string indicating the NHANES cycle of interest. Accepted formats include cycles like "0102" for 2001-2002, "0708" for 2007-2008, and so on.

  • DAY: Specifies which day's DII result to retrieve. Options include 'first' for Day 1, 'second' for Day 2, or 'both' for combined results from both days.

Here are several examples illustrating the use of the DII_NHANES_PLUS_RESULT() function across different NHANES cycles:

# Retrieve DII values for NHANES 2009-2010 on Day 1
dii_day1_0910 <- DII_NHANES_PLUS_RESULT(NHANESCycle = "2009-2010", DAY = c('first'))

# Retrieve DII values for NHANES 2011-2012 on Day 2
dii_day2_1112 <- DII_NHANES_PLUS_RESULT(NHANESCycle = "2011-2012", DAY = c('second'))

# Retrieve DII values for NHANES 2007-2008 for both Day 1 and Day 2
dii_both_0708 <- DII_NHANES_PLUS_RESULT(NHANESCycle = "2007-2008", DAY = c('both'))

Value:

The function returns a dataframe that includes the DII and its component values for the specified NHANES cycle.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published