Learn R Programming

BetaBit (version 2.2)

food: The food data from Rijksinstituut voor Volksgezondheid en Milieu

Description

The Dutch institute Rijksinstituut voor Volksgezondheid en Milieu has compiled a database with ingredient information on more than 2,200 food products. The data in this package is only a processed fraction of the huge and very interesting NEVO database available at https://www.rivm.nl/documenten/nevo-online-versie.

Arguments

Format

data frame: 2207 obs. of 9 variables

Details

The preprocessed data can be used to reproduce the charts from the book Wykresy od kuchni (Chart runners) https://github.com/BetaAndBit/Charts

Note that data frames food, food_max, food_mini, food_all have product names in English, while food_pl, food_max_pl, food_mini_pl, food_all_pl have product names in Polish.

Examples

Run this code
library("ggplot2")
head(food)

# \donttest{
library("ggthemes")
ggplot(data = food, aes(x = Energy)) +
   geom_histogram(color = "white") +
   facet_wrap(~Group) +
   labs(title = "Energy value of the products", subtitle = "per 100 g",
      x = "Energy value", y = "Number") +
   theme_economist()

ggplot(data = food_mini, aes(x = Energy)) +
   geom_histogram(color = "white") +
   facet_wrap(~Group) +
   labs(title = "Energy value of the products", subtitle = "per 100 g",
      x = "Energy value", y = "Number") +
   theme_economist()

ggplot(data = food, aes(x = Protein, y = Fats,
   color = Group, size = Energy)) +
     geom_point() +
   scale_color_brewer(type = "qual", palette = "Dark2") +
 labs(title = "Share of protein and fats", subtitle = "per 100 g",
      y = "Fats [g]", x = "Protein [g]") +
      theme_gdocs()

ggplot(data = food, aes(x = Group, y = Energy)) +
  geom_rug(sides = "l") +
  geom_violin(scale = "width", aes(fill = Group)) +
  geom_text(data = food_max, aes(label =  Name),
          hjust = 0, vjust = 0, color = "blue4") +
  geom_boxplot(width = 0.2, coef = 100) +
  coord_flip() +
  labs(title = "Energy value distribution", subtitle = "per 100 g") +
  theme_gdocs() + theme(legend.position = "none")

# }

Run the code above in your browser using DataLab