R/food.R

#' The food data from Rijksinstituut voor Volksgezondheid en Milieu
#'
#' 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 \url{https://www.rivm.nl/documenten/nevo-online-versie}.
#'
#' The preprocessed data can be used to reproduce the charts
#' from the book Wykresy od kuchni (Chart runners)
#' \url{https://github.com/BetaAndBit/Charts}
#'
#' Note that data frames \code{food}, \code{food_max}, \code{food_mini}, \code{food_all}
#' have product names in English, while
#' \code{food_pl}, \code{food_max_pl}, \code{food_mini_pl}, \code{food_all_pl}
#' have product names in Polish.
#'
#' @examples
#' 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")
#'
#' }
#'
#' @docType data
#' @keywords datasets
#' @name food
#' @aliases food food_max food_mini food_all food_pl food_max_pl food_mini_pl food_all_pl
#' @format data frame: 2207 obs. of 9 variables
NULL
BetaAndBit/BetaBitRgame documentation built on Aug. 27, 2023, 7:04 p.m.