The opinions expressed in the article are those of the author(s) only,
and may not necessarily represent the views of EFSA or of any other EU
Institution or body.
EFSA’s food consumption data
The European Food Safety Authority collects food consumption data from all EU countries and and integrates them in their database. The data is based on country specific surveys, in which individuals get interviewed about their food consumption habits. This data is used for EFSA’s risk assessments as part of the exposure assessment.
Accessing the data
The data is available from EFSA’s website http://www.efsa.europa.eu/en/food-consumption/comprehensive-database in form of Excel files.
I selected for this tutorial the file of the “Chronic food consumption statistics” – “grams per day” – “all subjects”.
The following code reads the data from the EFSA website and writes it to a local file.
The file contains 4 sheets and we select the last one, which contains data on the lowest foodex level 4.
First download and cache it,
and the read it into R. The I fix a different spelling in the data versus the shape files to be
used later for the map.
Description of data
The data is organised ‘per country’, ‘per survey’,’per population class’ and ‘per food group’.
The food classification follows the Foodex1 standard developed by EFSA, which is a hierarchical system for classifying food.
The current data set contains the most detailed foodex levels (3 and 4)
The ‘Mean’ column contains then the mean consumption in grams per day of this food among the participants of the survey. Additionally to the mean other statistics about the distribution of the food intake are given (standard deviation, percentiles)
We can interpret a single row, such as:
in the following way:
There was a food consumption survey with name ‘Austrian Study on Nutritional Status 2010-12 – Adults’ run in ‘Austria’.
One group of ‘308’ ‘Adults’ was surveyed and the ‘Mean’ food consumption of food ‘Couscous’ in that group was ‘1.28’ g intake per day. There are some more variables for the distribution of the daily intake. Note the large standard deviation, which means that the eating habits of ‘Couscous’ various a lot.
Analysis of standart deviation
One interesting question on this data is, which food are distributed evenly, so most individuals eat them in similar proportions.
One potential interpretation of those, is to say that these are the food which are ‘eaten in all of Europe, in all ages’ in the same quantities.
Lets find those with dplyr, like this:
|Oil, frying, blend||6.041108||6.292762|
|Margarine and similar products||7.385982||7.290324|
|Cream 40 % fat||7.488790||6.402034|
|Parsley root (Petroselinum crispum)||7.644194||11.049928|
|Duck meat (Anas spp.)||7.887929||5.294000|
|Coffee beans, roasted and ground||8.036786||7.561675|
|Cheese, Parmigiano Reggiano||8.367041||7.220518|
|Salad dressing, 25 – 50% oil||8.407296||5.696910|
|Spring onions, bulb (Allium cepa)||8.739136||5.635335|
|Jam, Raspberries (Rubus idaeus)||8.949646||8.119948|
So it seems that all Europeans agree on eating similar portions of :
- rice starch
- tomato ketchup
- cooked sausage
Prepare data for mapping
For mapping purposes we can now decide which food group we want to use, ‘Jam’ in this case, and need to decide, how to aggregate the data of the different surveys and population groups. In this case I take the most simple approach, which is to average over all surveys and population groups.
This is good enough for illustrative purposes, but a exposure assessment based on this data needed to find a more sophisticated strategy in order to consider methodological differences between the studies.
A more detailed explained on how to use this data, see EFSA’s website.2
The data is now in a format, ready to be presented in a pan European map, having a single value per country.
For this tutorial we will use the tmap package.
It comes already with a shape file of Europe.
First we will restrict it to EU countries:
The tmap library allows to append this data easily to an existing European shape file, by using the ‘append_data’ function.
As the spelling of ‘Czech Republic’ in the data does not match the shape file, we rename it here.
The ‘key.shp’ and ‘key.data’ parameter specify, on which columns the data and the shape file should be joined.
Showing a pan european map of food consumption data
A simple map of one food item
The data can now be shown on the screen as a simple map, containing one layer which represents the mean food consumption of ‘jam’, where the quantity is represented as color of the country polygon, increasing the level of darkness of the color by increased consumption.
This map show, that France and Germany seems to be the top Jam consumers.
A more advanced map
We can easily add extra information to the map, like the ISO code of the countries, which are in column ‘iso_a3’ of the shape file. We do this by adding a text layer with ‘tm_text’, specifying which column of the shape file contains the textual information to show.
Showing multiple maps
The following code shows one of the strength of using tmap, which is the very easy creation of multiple maps.
Let’s see how to show 4 maps, each with a different food.
First we filter the data by the 4 foods, and then we transform it from ‘long’ to ‘wide’ format with the ‘tidyr’ packages.
This results in a table, which has one column per food:
|Country||Couscous||Dried fruits||Jam||Wheat grain|
This new data frame will be merged with the shape file
and then be plotted as 4 maps, by just using a vector with the column names in the ‘col’ argument of tm_polygons.
This will plot one map for each column name in the vector.
Map of people surveyed
An other type of information which can be extracted from the data set, is information about the food consumption surveys.
The following code counts the number of individuals, which were surveyed per country.
In case of various surveys, I just sum it up.
This can be plotted as a bar chart, to compare easily the number of individuals surveyed.
As we can see, there are large differences between them. Some Nordic countries have each surveyed more then 5000 individuals, while others have below 1000.
The same data shown as map shows a rather clear difference between north and southern Europe.
Does this mean that the (richer) Nordic countries invest more money in food consumption surveys ?
Or is it related to population (only) ?
A first hint to this question is to look at number of individuals together with GDP and population of a country.
Who eats most vegetables ?
By filtering data dependent on the highes L1 foodex level, we can get an glimpse on meat vs. non meat consumption in Europe.
Tmap has as well an interactive mode. To demonstrate it, we will now add two layers we have used before,’Jam consumption’ and ‘# individuals surveyed’ to the same interactive map.
In such a map the user can:
- change background (online) map
- zoom and drag the mp
- select layers to see (Jam consumption,#individuals)
- click on countries to see all information for this country in the shape file
As this blog is done with knitr, the interactive map is not shown.
The following R library versions were used for this tutorial.