Skip to contents

Draws a patchwork grid of bar charts, one panel per IFCT table that has data for the food. Requires the patchwork package.

Usage

plot_food_profile(
  food,
  match = c("fixed", "regex"),
  se = TRUE,
  ncol = 2L,
  label_fn = function(x) gsub("_.*", "", x)
)

Arguments

food

Food name (substring) or exact food code.

match

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

se

If TRUE (default), overlay +/-1 SE error bars where available.

ncol

Number of columns in the panel grid (default 2).

label_fn

Function to shorten nutrient column names.

Value

A patchwork object.

Examples

plot_food_profile("Bengal gram")
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 2 rows for 2 foods.
#>  Retrieved 1 row for 1 food.
#>  Retrieved 1 row for 1 food.
#> Warning: No foods matching "Bengal gram" found in table "edible_oils".
#> Warning: No foods matching "Bengal gram" found in table "edible_oils".
#>  Retrieved 2 rows for 2 foods.

plot_food_profile("Egg")
#>  Retrieved 16 rows for 16 foods.
#>  Retrieved 16 rows for 16 foods.
#>  Retrieved 16 rows for 16 foods.
#>  Retrieved 16 rows for 16 foods.
#>  Retrieved 16 rows for 16 foods.
#>  Retrieved 16 rows for 16 foods.
#>  Retrieved 15 rows for 15 foods.
#>  Retrieved 15 rows for 15 foods.
#>  Retrieved 16 rows for 16 foods.
#>  Retrieved 16 rows for 16 foods.
#> Warning: No foods matching "Egg" found in table "sugars".
#> Warning: No foods matching "Egg" found in table "sugars".
#>  Retrieved 15 rows for 15 foods.
#>  Retrieved 15 rows for 15 foods.
#>  Retrieved 15 rows for 15 foods.
#>  Retrieved 15 rows for 15 foods.
#> Warning: No foods matching "Egg" found in table "organic_acids".
#> Warning: No foods matching "Egg" found in table "organic_acids".
#> Warning: No foods matching "Egg" found in table "polyphenols".
#> Warning: No foods matching "Egg" found in table "polyphenols".
#> Warning: No foods matching "Egg" found in table "oligosaccharides".
#> Warning: No foods matching "Egg" found in table "oligosaccharides".
#> Warning: No foods matching "Egg" found in table "edible_oils".
#> Warning: No foods matching "Egg" found in table "edible_oils".
#>  Retrieved 16 rows for 16 foods.