Skip to contents

Retrieve rows from one or all IFCT 2017 nutrient tables, filtered by food name or food code.

Usage

get_nutrition(
  food = NULL,
  table = NULL,
  nutrients = NULL,
  se = FALSE,
  match = c("fixed", "regex")
)

Arguments

food

Character string matched against food name (case-insensitive substring) or food code (exact). NULL returns all foods.

table

One of "proximate", "vitamins_water", "vitamins_fat", "carotenoids", "minerals", "sugars", "fatty_acids", "amino_acids", "organic_acids", "polyphenols", "oligosaccharides", "edible_oils". NULL joins all tables on food code and returns a wide result.

nutrients

Optional character vector of column name substrings to select (applied after table filter). NULL returns all columns.

se

If TRUE, return standard errors instead of point estimates.

match

One of "fixed" (default) or "regex".

Value

A tibble.

Examples

# All proximate data for rice
get_nutrition("rice", table = "proximate")
#>  Retrieved 6 rows for 6 foods.
#> # A tibble: 6 × 12
#>   `Food code` `Food name`        `No. of region` `Water(g)` `Protein_PROTCNT(g)`
#>   <chr>       <chr>                        <dbl>      <dbl>                <dbl>
#> 1 A011        "(Oryza sativa )\…               6      10.4                  7.44
#> 2 A012        "Rice puffed (Ory…               6       9.4                  7.47
#> 3 A013        "Rice, raw, brown…               6       9.33                 9.16
#> 4 A014        "Rice, parboiled,…               6      10.1                  7.81
#> 5 A015        "Rice, raw, mille…               6       9.93                 7.94
#> 6 B023        "Ricebean (Vigna …               1      11.1                 20.0 
#> # ℹ 7 more variables: `Ash(g)` <dbl>, `TotalFat_FATCE(g)` <dbl>,
#> #   `TotalDietaryFibre_FIBTG(g)` <dbl>, `InsolubleFibre_FIBINS(g)` <dbl>,
#> #   `SolubleFibre_FINSOL(g)` <dbl>, `AvailableCarbohydrate_CHOAVLDF(g)` <dbl>,
#> #   `Energy_ENERC(KJ)` <dbl>

# Amino acid profile for dal (any lentil/legume)
get_nutrition("dal", table = "amino_acids")
#>  Retrieved 8 rows for 8 foods.
#> # A tibble: 8 × 21
#>   `Food code` `Food name` `No. of region` `Histidine_HIS(g)` `Isoleucine_ILE(g)`
#>   <chr>       <chr>       <chr>                        <dbl>               <dbl>
#> 1 B001        "Bengal gr… 6                             2.39                4.25
#> 2 B004        "Black gra… 6                             2.85                3.42
#> 3 B010        "Vigna rad… 6                             2.55                4.07
#> 4 B013        "Lentil da… 6                             1.93                3.74
#> 5 B021        "Red gram,… 6                             3.16                3.42
#> 6 H001        "Almond (P… 6                             2.22                2.38
#> 7 P020        "Kadal bra… 1                            NA                   5   
#> 8 P021        "Kadali (N… 1                            NA                   6.23
#> # ℹ 16 more variables: `Leucine_LEU(g)` <dbl>, `Lysine_LYS(g)` <dbl>,
#> #   `Methionine_MET(g)` <dbl>, `Cysteine_CYS(g)` <dbl>,
#> #   `Phenylalanine_PHE(g)` <dbl>, `Threonine_THR(g)` <dbl>,
#> #   `Tryptophan_TRP(g)` <dbl>, `Valine_VAL(g)` <dbl>, `Alanine_ALA(g)` <dbl>,
#> #   `Arginine_ARG(g)` <dbl>, `AsparticAcid_ASP(g)` <dbl>,
#> #   `GlutamicAcid_GLU(g)` <dbl>, `Glycine_GLY(g)` <dbl>,
#> #   `Proline_PRO(g)` <dbl>, `Serine_SER(g)` <dbl>, `Tyrosine_TYR(g)` <dbl>

# Iron and calcium for all foods
get_nutrition(table = "minerals", nutrients = c("Iron", "Calcium"))
#>  Retrieved 528 rows for 528 foods.
#> # A tibble: 528 × 5
#>    `Food code` `Food name`        `No. of region` `Calcium_Ca(mg)` `Iron_Fe(mg)`
#>    <chr>       <chr>              <chr>                      <dbl>         <dbl>
#>  1 A001        Amaranth seed, bl… 1                         181             9.33
#>  2 A002        Amaranth seed, pa… 6                         162             8.02
#>  3 A003        Bajra (Pennisetum… 6                          27.4           6.42
#>  4 A004        Barley (Hordeum v… 6                          28.6           1.56
#>  5 A005        Jowar (Sorghum vu… 6                          27.6           3.95
#>  6 A006        Maize, dry (Zea m… 6                           8.91          2.49
#>  7 A007        Maize, tender, lo… 6                           6.35          0.71
#>  8 A008        Maize, tender, sw… 4                           6.37          0.54
#>  9 A009        Quinoa(Chenopodiu… 1                         198             7.51
#> 10 A010        Ragi (Eleusine co… 5                         364             4.62
#> # ℹ 518 more rows

# Standard errors for protein content
get_nutrition("wheat", table = "proximate", se = TRUE)
#>  Retrieved 7 rows for 7 foods.
#> # A tibble: 7 × 12
#>   `Food code` `Food name`        `No. of region` `Water(g)` `Protein_PROTCNT(g)`
#>   <chr>       <chr>                        <dbl>      <dbl>                <dbl>
#> 1 A018        Wheat flour, refi…               6       0.93                 0.29
#> 2 A019        Wheat flour, atta…               6       0.35                 0.37
#> 3 A020        Wheat, whole (Tri…               6       1.11                 0.6 
#> 4 A021        Wheat, bulgur (Tr…               6       0.32                 0.75
#> 5 A022        Wheat, semolina (…               6       0.68                 0.37
#> 6 A023        Wheat, vermicelli…               6       0.37                 0.52
#> 7 A024        Wheat, vermicelli…               6       0.47                 0.7 
#> # ℹ 7 more variables: `Ash(g)` <dbl>, `TotalFat_FATCE(g)` <dbl>,
#> #   `TotalDietaryFibre_FIBTG(g)` <dbl>, `InsolubleFibre_FIBINS(g)` <dbl>,
#> #   `SolubleFibre_FINSOL(g)` <dbl>, `AvailableCarbohydrate_CHOAVLDF(g)` <dbl>,
#> #   `Energy_ENERC(KJ)` <dbl>