Mayuri Ingle
01/15/2019
About the dataset from Kaggle :
Context Our world population is expected to grow from 7.3 billion today to 9.7 billion in the year 2050. Finding solutions for feeding the growing world population has become a hot topic for food and agriculture organizations, entrepreneurs and philanthropists. These solutions range from changing the way we grow our food to changing the way we eat. To make things harder, the world’s climate is changing and it is both affecting and affected by the way we grow our food – agriculture. This dataset provides an insight on our worldwide food production - focusing on a comparison between food produced for human consumption and feed produced for animals.
Content The Food and Agriculture Organization of the United Nations provides free access to food and agriculture data for over 245 countries and territories, from the year 1961 to the most recent update (depends on the dataset). One dataset from the FAO’s database is the Food Balance Sheets. It presents a comprehensive picture of the pattern of a country’s food supply during a specified reference period, the last time an update was loaded to the FAO database was in 2013. The food balance sheet shows for each food item the sources of supply and its utilization. This chunk of the dataset is focused on two utilizations of each food item available:
Food - refers to the total amount of the food item available as human food during the reference period. Feed - refers to the quantity of the food item available for feeding to the livestock and poultry during the reference period. Dataset’s attributes:
Area code - Country name abbreviation Area - County name Item - Food item Element - Food or Feed Latitude - geographic coordinate that specifies the north–south position of a point on the Earth’s surface Longitude - geographic coordinate that specifies the east-west position of a point on the Earth’s surface Production per year - Amount of food item produced in 1000 tonnes
Countries which were formed lately such as South Sudan etc do not have all full data going back to 1961.
Let’s begin with our exploratory data analysis using tidyverse.
# Import all required libraries
library(tidyverse)
## -- Attaching packages ------------ tidyverse 1.2.1 --
## v ggplot2 3.1.0 v purrr 0.2.5
## v tibble 2.0.1 v dplyr 0.7.8
## v tidyr 0.8.2 v stringr 1.3.1
## v readr 1.3.1 v forcats 0.3.0
## -- Conflicts --------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
# Loading our dataset
FAO <- read_csv("F:\\RFiles\\Datasets\\FAO.csv")
## Parsed with column specification:
## cols(
## .default = col_double(),
## `Area Abbreviation` = col_character(),
## Area = col_character(),
## Item = col_character(),
## Element = col_character(),
## Unit = col_character()
## )
## See spec(...) for full column specifications.
# Overview of dataset
glimpse(FAO)
## Observations: 21,477
## Variables: 63
## $ `Area Abbreviation` <chr> "AFG", "AFG", "AFG", "AFG", "AFG", "AFG", ...
## $ `Area Code` <dbl> 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ...
## $ Area <chr> "Afghanistan", "Afghanistan", "Afghanistan...
## $ `Item Code` <dbl> 2511, 2805, 2513, 2513, 2514, 2514, 2517, ...
## $ Item <chr> "Wheat and products", "Rice (Milled Equiva...
## $ `Element Code` <dbl> 5142, 5142, 5521, 5142, 5521, 5142, 5142, ...
## $ Element <chr> "Food", "Food", "Feed", "Food", "Feed", "F...
## $ Unit <chr> "1000 tonnes", "1000 tonnes", "1000 tonnes...
## $ latitude <dbl> 33.94, 33.94, 33.94, 33.94, 33.94, 33.94, ...
## $ longitude <dbl> 67.71, 67.71, 67.71, 67.71, 67.71, 67.71, ...
## $ Y1961 <dbl> 1928, 183, 76, 237, 210, 403, 17, 0, 111, ...
## $ Y1962 <dbl> 1904, 183, 76, 237, 210, 403, 18, 0, 97, 4...
## $ Y1963 <dbl> 1666, 182, 76, 237, 214, 410, 19, 0, 103, ...
## $ Y1964 <dbl> 1950, 220, 76, 238, 216, 415, 20, 0, 110, ...
## $ Y1965 <dbl> 2001, 220, 76, 238, 216, 415, 21, 0, 113, ...
## $ Y1966 <dbl> 1808, 195, 75, 237, 216, 413, 22, 0, 117, ...
## $ Y1967 <dbl> 2053, 231, 71, 225, 235, 454, 23, 0, 128, ...
## $ Y1968 <dbl> 2045, 235, 72, 227, 232, 448, 24, 0, 130, ...
## $ Y1969 <dbl> 2154, 238, 73, 230, 236, 455, 25, 0, 134, ...
## $ Y1970 <dbl> 1819, 213, 74, 234, 200, 383, 26, 0, 125, ...
## $ Y1971 <dbl> 1963, 205, 71, 223, 201, 386, 26, 0, 147, ...
## $ Y1972 <dbl> 2215, 233, 70, 219, 216, 416, 27, 0, 138, ...
## $ Y1973 <dbl> 2310, 246, 72, 225, 228, 439, 27, 0, 143, ...
## $ Y1974 <dbl> 2335, 246, 76, 240, 231, 445, 28, 0, 160, ...
## $ Y1975 <dbl> 2434, 255, 77, 244, 234, 451, 29, 0, 169, ...
## $ Y1976 <dbl> 2512, 263, 80, 255, 240, 463, 37, 0, 324, ...
## $ Y1977 <dbl> 2282, 235, 60, 185, 228, 439, 32, 0, 176, ...
## $ Y1978 <dbl> 2454, 254, 65, 203, 234, 451, 33, 0, 225, ...
## $ Y1979 <dbl> 2443, 270, 64, 198, 228, 440, 31, 0, 232, ...
## $ Y1980 <dbl> 2129, 259, 64, 202, 226, 437, 31, 0, 240, ...
## $ Y1981 <dbl> 2133, 248, 60, 189, 210, 407, 29, 0, 247, ...
## $ Y1982 <dbl> 2068, 217, 55, 174, 199, 384, 27, 0, 248, ...
## $ Y1983 <dbl> 1994, 217, 53, 167, 192, 371, 28, 0, 242, ...
## $ Y1984 <dbl> 1851, 197, 51, 160, 182, 353, 26, 0, 235, ...
## $ Y1985 <dbl> 1791, 186, 48, 151, 173, 334, 25, 0, 226, ...
## $ Y1986 <dbl> 1683, 200, 46, 145, 170, 330, 23, 0, 217, ...
## $ Y1987 <dbl> 2194, 193, 46, 145, 154, 298, 23, 0, 196, ...
## $ Y1988 <dbl> 1801, 202, 47, 148, 148, 287, 23, 0, 198, ...
## $ Y1989 <dbl> 1754, 191, 46, 145, 137, 265, 23, 0, 184, ...
## $ Y1990 <dbl> 1640, 199, 43, 135, 144, 279, 24, 0, 205, ...
## $ Y1991 <dbl> 1539, 197, 43, 132, 126, 245, 24, 0, 203, ...
## $ Y1992 <dbl> 1582, 249, 40, 120, 90, 170, 18, 0, 210, 2...
## $ Y1993 <dbl> 1840, 218, 50, 155, 141, 272, 22, 0, 210, ...
## $ Y1994 <dbl> 1855, 260, 46, 143, 150, 289, 20, 0, 211, ...
## $ Y1995 <dbl> 1853, 319, 41, 125, 159, 310, 21, 0, 212, ...
## $ Y1996 <dbl> 2177, 254, 44, 138, 108, 209, 17, 0, 213, ...
## $ Y1997 <dbl> 2343, 326, 50, 159, 90, 173, 20, 0, 214, 2...
## $ Y1998 <dbl> 2407, 347, 48, 154, 99, 192, 21, 0, 214, 2...
## $ Y1999 <dbl> 2463, 270, 43, 141, 72, 141, 17, 0, 217, 2...
## $ Y2000 <dbl> 2600, 372, 26, 84, 35, 66, 20, 0, 219, 29,...
## $ Y2001 <dbl> 2668, 411, 29, 83, 48, 93, 20, 0, 215, 29,...
## $ Y2002 <dbl> 2776, 448, 70, 122, 89, 170, 18, 0, 217, 2...
## $ Y2003 <dbl> 3095, 460, 48, 144, 63, 117, 16, 1, 347, 5...
## $ Y2004 <dbl> 3249, 419, 58, 185, 120, 231, 15, 2, 276, ...
## $ Y2005 <dbl> 3486, 445, 236, 43, 208, 67, 21, 1, 294, 2...
## $ Y2006 <dbl> 3704, 546, 262, 44, 233, 82, 11, 1, 294, 6...
## $ Y2007 <dbl> 4164, 455, 263, 48, 249, 67, 19, 0, 260, 6...
## $ Y2008 <dbl> 4252, 490, 230, 62, 247, 69, 21, 0, 242, 5...
## $ Y2009 <dbl> 4538, 415, 379, 55, 195, 71, 18, 0, 250, 1...
## $ Y2010 <dbl> 4605, 442, 315, 60, 178, 82, 14, 0, 192, 8...
## $ Y2011 <dbl> 4711, 476, 203, 72, 191, 73, 14, 0, 169, 8...
## $ Y2012 <dbl> 4810, 425, 367, 78, 200, 77, 14, 0, 196, 6...
## $ Y2013 <dbl> 4895, 422, 360, 89, 200, 76, 12, 0, 230, 8...
The dataset has 21477 observations and 63 variables, where we have details of Food and Feed production by country from 1961 to 2013, including geocoding of Countries. The Element code describes the code given to Food(5142) and Feed(5521) and all the measurements are in 1000 tonnes. We have different Food and Feed items and their codes such as wheat & products, barley & products, maize & products, bananas, grapes and so on.
# Formating column names
colnames(FAO) <- str_replace(names(FAO)," " ,"_")
colnames(FAO)[1] <- "Area_abb"
# Selecting required columns
FAO1<- FAO[,-c(2,4,6,8,9,10)]
names(FAO1)
## [1] "Area_abb" "Area" "Item" "Element" "Y1961" "Y1962"
## [7] "Y1963" "Y1964" "Y1965" "Y1966" "Y1967" "Y1968"
## [13] "Y1969" "Y1970" "Y1971" "Y1972" "Y1973" "Y1974"
## [19] "Y1975" "Y1976" "Y1977" "Y1978" "Y1979" "Y1980"
## [25] "Y1981" "Y1982" "Y1983" "Y1984" "Y1985" "Y1986"
## [31] "Y1987" "Y1988" "Y1989" "Y1990" "Y1991" "Y1992"
## [37] "Y1993" "Y1994" "Y1995" "Y1996" "Y1997" "Y1998"
## [43] "Y1999" "Y2000" "Y2001" "Y2002" "Y2003" "Y2004"
## [49] "Y2005" "Y2006" "Y2007" "Y2008" "Y2009" "Y2010"
## [55] "Y2011" "Y2012" "Y2013"
We will quickly check how many distinct countries , food and feed items are avaliable in dataset
# Distinct Countries /Area :
unique(FAO$Area)
## [1] "Afghanistan"
## [2] "Albania"
## [3] "Algeria"
## [4] "Angola"
## [5] "Antigua and Barbuda"
## [6] "Argentina"
## [7] "Armenia"
## [8] "Australia"
## [9] "Austria"
## [10] "Azerbaijan"
## [11] "Bahamas"
## [12] "Bangladesh"
## [13] "Barbados"
## [14] "Belarus"
## [15] "Belgium"
## [16] "Belize"
## [17] "Benin"
## [18] "Bermuda"
## [19] "Bolivia (Plurinational State of)"
## [20] "Bosnia and Herzegovina"
## [21] "Botswana"
## [22] "Brazil"
## [23] "Brunei Darussalam"
## [24] "Bulgaria"
## [25] "Burkina Faso"
## [26] "Cabo Verde"
## [27] "Cambodia"
## [28] "Cameroon"
## [29] "Canada"
## [30] "Central African Republic"
## [31] "Chad"
## [32] "Chile"
## [33] "China, Hong Kong SAR"
## [34] "China, Macao SAR"
## [35] "China, mainland"
## [36] "China, Taiwan Province of"
## [37] "Colombia"
## [38] "Congo"
## [39] "Costa Rica"
## [40] "C<f4>te d'Ivoire"
## [41] "Croatia"
## [42] "Cuba"
## [43] "Cyprus"
## [44] "Czechia"
## [45] "Democratic People's Republic of Korea"
## [46] "Denmark"
## [47] "Djibouti"
## [48] "Dominica"
## [49] "Dominican Republic"
## [50] "Ecuador"
## [51] "Egypt"
## [52] "El Salvador"
## [53] "Estonia"
## [54] "Ethiopia"
## [55] "Fiji"
## [56] "Finland"
## [57] "France"
## [58] "French Polynesia"
## [59] "Gabon"
## [60] "Gambia"
## [61] "Georgia"
## [62] "Germany"
## [63] "Ghana"
## [64] "Greece"
## [65] "Grenada"
## [66] "Guatemala"
## [67] "Guinea"
## [68] "Guinea-Bissau"
## [69] "Guyana"
## [70] "Haiti"
## [71] "Honduras"
## [72] "Hungary"
## [73] "Iceland"
## [74] "India"
## [75] "Indonesia"
## [76] "Iran (Islamic Republic of)"
## [77] "Iraq"
## [78] "Ireland"
## [79] "Israel"
## [80] "Italy"
## [81] "Jamaica"
## [82] "Japan"
## [83] "Jordan"
## [84] "Kazakhstan"
## [85] "Kenya"
## [86] "Kiribati"
## [87] "Kuwait"
## [88] "Kyrgyzstan"
## [89] "Lao People's Democratic Republic"
## [90] "Latvia"
## [91] "Lebanon"
## [92] "Lesotho"
## [93] "Liberia"
## [94] "Lithuania"
## [95] "Luxembourg"
## [96] "Madagascar"
## [97] "Malawi"
## [98] "Malaysia"
## [99] "Maldives"
## [100] "Mali"
## [101] "Malta"
## [102] "Mauritania"
## [103] "Mauritius"
## [104] "Mexico"
## [105] "Mongolia"
## [106] "Montenegro"
## [107] "Morocco"
## [108] "Mozambique"
## [109] "Myanmar"
## [110] "Namibia"
## [111] "Nepal"
## [112] "Netherlands"
## [113] "New Caledonia"
## [114] "New Zealand"
## [115] "Nicaragua"
## [116] "Niger"
## [117] "Nigeria"
## [118] "Norway"
## [119] "Oman"
## [120] "Pakistan"
## [121] "Panama"
## [122] "Paraguay"
## [123] "Peru"
## [124] "Philippines"
## [125] "Poland"
## [126] "Portugal"
## [127] "Republic of Korea"
## [128] "Republic of Moldova"
## [129] "Romania"
## [130] "Russian Federation"
## [131] "Rwanda"
## [132] "Saint Kitts and Nevis"
## [133] "Saint Lucia"
## [134] "Saint Vincent and the Grenadines"
## [135] "Samoa"
## [136] "Sao Tome and Principe"
## [137] "Saudi Arabia"
## [138] "Senegal"
## [139] "Serbia"
## [140] "Sierra Leone"
## [141] "Slovakia"
## [142] "Slovenia"
## [143] "Solomon Islands"
## [144] "South Africa"
## [145] "Spain"
## [146] "Sri Lanka"
## [147] "Sudan"
## [148] "Suriname"
## [149] "Swaziland"
## [150] "Sweden"
## [151] "Switzerland"
## [152] "Tajikistan"
## [153] "Thailand"
## [154] "The former Yugoslav Republic of Macedonia"
## [155] "Timor-Leste"
## [156] "Togo"
## [157] "Trinidad and Tobago"
## [158] "Tunisia"
## [159] "Turkey"
## [160] "Turkmenistan"
## [161] "Uganda"
## [162] "Ukraine"
## [163] "United Arab Emirates"
## [164] "United Kingdom"
## [165] "United Republic of Tanzania"
## [166] "United States of America"
## [167] "Uruguay"
## [168] "Uzbekistan"
## [169] "Vanuatu"
## [170] "Venezuela (Bolivarian Republic of)"
## [171] "Viet Nam"
## [172] "Yemen"
## [173] "Zambia"
## [174] "Zimbabwe"
# Distinct food and feed items :
feedItems <- FAO1%>%
filter(Element == "Feed")
unique(feedItems$Item)
## [1] "Barley and products" "Maize and products"
## [3] "Sugar cane" "Sugar beet"
## [5] "Pulses, Other and products" "Milk - Excluding Butter"
## [7] "Cereals - Excluding Beer" "Sugar Crops"
## [9] "Pulses" "Wheat and products"
## [11] "Rice (Milled Equivalent)" "Oats"
## [13] "Millet and products" "Sorghum and products"
## [15] "Cereals, Other" "Potatoes and products"
## [17] "Beans" "Olives (including preserved)"
## [19] "Oilcrops, Other" "Vegetables, Other"
## [21] "Pelagic Fish" "Starchy Roots"
## [23] "Oilcrops" "Vegetables"
## [25] "Fish, Seafood" "Soyabeans"
## [27] "Cassava and products" "Fish, Body Oil"
## [29] "Marine Fish, Other" "Animal fats"
## [31] "Rye and products" "Freshwater Fish"
## [33] "Demersal Fish" "Roots, Other"
## [35] "Peas" "Sunflower seed"
## [37] "Rape and Mustardseed" "Apples and products"
## [39] "Cloves" "Fruits - Excluding Wine"
## [41] "Spices" "Sweet potatoes"
## [43] "Sugar (Raw Equivalent)" "Sugar & Sweeteners"
## [45] "Soyabean Oil" "Poultry Meat"
## [47] "Crustaceans" "Vegetable Oils"
## [49] "Meat" "Cottonseed"
## [51] "Sesame seed" "Fruits, Other"
## [53] "Fats, Animals, Raw" "Plantains"
## [55] "Yams" "Bananas"
## [57] "Sweeteners, Other" "Butter, Ghee"
## [59] "Fish, Liver Oil" "Coconuts - Incl Copra"
## [61] "Offals, Edible" "Offals"
## [63] "Mutton & Goat Meat" "Meat, Other"
## [65] "Cephalopods" "Palm kernels"
## [67] "Palm Oil" "Sugar non-centrifugal"
## [69] "Olive Oil" "Groundnuts (Shelled Eq)"
## [71] "Oilcrops Oil, Other" "Cocoa Beans and products"
## [73] "Bovine Meat" "Stimulants"
## [75] "Rape and Mustard Oil" "Tomatoes and products"
## [77] "Onions" "Eggs"
## [79] "Tea (including mate)" "Dates"
## [81] "Oranges, Mandarines" "Grapefruit and products"
## [83] "Molluscs, Other" "Aquatic Plants"
## [85] "Aquatic Products, Other" "Sesameseed Oil"
## [87] "Grapes and products (excl wine)" "Honey"
foodItems <- FAO1%>%
filter(Element == "Food")
unique(foodItems$Item)
## [1] "Wheat and products" "Rice (Milled Equivalent)"
## [3] "Barley and products" "Maize and products"
## [5] "Millet and products" "Cereals, Other"
## [7] "Potatoes and products" "Sugar (Raw Equivalent)"
## [9] "Sweeteners, Other" "Honey"
## [11] "Pulses, Other and products" "Nuts and products"
## [13] "Coconuts - Incl Copra" "Sesame seed"
## [15] "Olives (including preserved)" "Soyabean Oil"
## [17] "Groundnut Oil" "Sunflowerseed Oil"
## [19] "Rape and Mustard Oil" "Cottonseed Oil"
## [21] "Palm Oil" "Sesameseed Oil"
## [23] "Olive Oil" "Oilcrops Oil, Other"
## [25] "Tomatoes and products" "Vegetables, Other"
## [27] "Oranges, Mandarines" "Citrus, Other"
## [29] "Bananas" "Apples and products"
## [31] "Pineapples and products" "Dates"
## [33] "Grapes and products (excl wine)" "Fruits, Other"
## [35] "Coffee and products" "Cocoa Beans and products"
## [37] "Tea (including mate)" "Pepper"
## [39] "Spices, Other" "Wine"
## [41] "Beer" "Beverages, Alcoholic"
## [43] "Bovine Meat" "Mutton & Goat Meat"
## [45] "Poultry Meat" "Meat, Other"
## [47] "Offals, Edible" "Butter, Ghee"
## [49] "Cream" "Fats, Animals, Raw"
## [51] "Eggs" "Milk - Excluding Butter"
## [53] "Freshwater Fish" "Infant food"
## [55] "Cereals - Excluding Beer" "Starchy Roots"
## [57] "Sugar & Sweeteners" "Pulses"
## [59] "Treenuts" "Oilcrops"
## [61] "Vegetable Oils" "Vegetables"
## [63] "Fruits - Excluding Wine" "Stimulants"
## [65] "Spices" "Alcoholic Beverages"
## [67] "Meat" "Offals"
## [69] "Animal fats" "Fish, Seafood"
## [71] "Miscellaneous" "Rye and products"
## [73] "Oats" "Cassava and products"
## [75] "Sweet potatoes" "Roots, Other"
## [77] "Beans" "Peas"
## [79] "Soyabeans" "Groundnuts (Shelled Eq)"
## [81] "Rape and Mustardseed" "Maize Germ Oil"
## [83] "Onions" "Lemons, Limes and products"
## [85] "Grapefruit and products" "Plantains"
## [87] "Pimento" "Beverages, Fermented"
## [89] "Pigmeat" "Fish, Body Oil"
## [91] "Fish, Liver Oil" "Demersal Fish"
## [93] "Pelagic Fish" "Marine Fish, Other"
## [95] "Crustaceans" "Cephalopods"
## [97] "Molluscs, Other" "Aquatic Animals, Others"
## [99] "Aquatic Plants" "Aquatic Products, Other"
## [101] "Sorghum and products" "Palm kernels"
## [103] "Coconut Oil" "Cloves"
## [105] "Palmkernel Oil" "Yams"
## [107] "Sunflower seed" "Oilcrops, Other"
## [109] "Sugar cane" "Sugar non-centrifugal"
## [111] "Ricebran Oil" "Sugar Crops"
## [113] "Meat, Aquatic Mammals" "Sugar beet"
## [115] "Cottonseed"
Well , we have 174 distinct countries , 115 food items and 88 feed items .
Let’s have look at missing data .
# Visualise missing data
FAO1 %>%
gather(Year, Production, Y1961:Y2013) %>%
filter(is.na(Production)) %>%
group_by(Year)%>% tally()%>%
ggplot(aes(Year,n))+
geom_col(fill = "lightblue")+
theme(axis.text.x = element_text(size=6, angle=90),
panel.background = element_blank())+
geom_text(aes(label = sprintf("%d", n)), hjust = 0.5,
vjust = -0.5, size = 3, check_overlap = TRUE)+
ylab("No. of missing fields")
As metioned in the dataset details, the production details for the countries newly formed are missing , graph shows details are missing from inital years till 2011.
Let’s have a look at trend in total food and feed production since 1961
# Total Food n Feed production since 1961
FAO1 %>%
gather(Year, Production, Y1961:Y2013, na.rm = TRUE) %>%
group_by(Element,Year)%>%
summarise(Production = sum(Production)/1000)%>%
ggplot(aes(Year,Production,group = Element))+
geom_col(aes(fill = Element),position = "dodge") +
theme_bw()+theme(axis.text.x = element_text(size=6, angle=90),
plot.title = element_text(hjust = 0.5),
panel.grid = element_blank(),legend.title = element_blank())+
ylab( "Production (in million Tonnes)")+
ggtitle ( "Total Food n Feed production since 1961")
We can see steep rise in food production as compared to feed over these years. There is huge difference in overall food and feed production.
Let’s see who are the largest food producers in world.
#Top 5 food producers since 1961
# Calculate top 5 food producers
FAO2 <- FAO1 %>%
gather(Year, Production, Y1961:Y2013, na.rm = TRUE) %>%
group_by(Area_abb,Element)
topFood <-FAO2 %>%
filter(Element == "Food") %>%
summarise(totalp = sum(Production)/1000)%>%
ungroup()%>%
top_n(5,totalp)
topFood %>% select(Area_abb,totalp) %>% arrange(desc(totalp))
## # A tibble: 5 x 2
## Area_abb totalp
## <chr> <dbl>
## 1 CHN 62314.
## 2 IND 34570.
## 3 USA 26227.
## 4 BRA 9394.
## 5 DEU 7978.
# Plot year wise production of top 5 producers
topFoodY <-FAO1 %>%
gather(Year, Production, Y1961:Y2013, na.rm = TRUE) %>%
group_by(Area_abb,Year,Element) %>%
filter(Element == "Food" & Area_abb %in% topFood$Area_abb) %>%
summarise(totalp = sum(Production)/1000)
topFoodY %>%
ggplot(aes(Year,totalp,group = Area_abb,color = Area_abb))+
geom_line(size = 1) + xlab("Item")+
ylab( "Production (in millon Tonnes)")+
ggtitle ( "Top 5 Food Producers since 1961")+theme_bw()+
theme(axis.text.x = element_text(size=6, angle=90),
plot.title = element_text(hjust = 0.5),
panel.grid = element_blank(),
legend.title = element_blank())
World’s largest food producers are China,India and USA . Above graph also shows exponential growth in China’s food production in last 10 years.
Similary we will have a look at largest feed producers in world .
#Top 5 feed producers since 1961
topFeed <- FAO2%>%
filter(Element == "Feed") %>%
summarise(totalp = sum(Production)/1000)%>%
ungroup()%>%
top_n(5,totalp)
topFeedY <-FAO1 %>%
gather(Year, Production, Y1961:Y2013, na.rm = TRUE) %>%
group_by(Area_abb,Year,Element) %>%
filter(Element == "Feed" & Area_abb %in% topFeed$Area_abb) %>%
summarise(totalp = sum(Production)/1000)
topFeed %>% select(Area_abb,totalp) %>% arrange(desc(totalp))
## # A tibble: 5 x 2
## Area_abb totalp
## <chr> <dbl>
## 1 CHN 16139.
## 2 USA 15492.
## 3 BRA 4424.
## 4 DEU 4323.
## 5 POL 3729.
# Plot year wise production of top 5 producers
topFeedY %>%
ggplot(aes(Year,totalp,group = Area_abb,color = Area_abb))+
geom_line(size = 1) + xlab("Item")+
ylab( "Production (in millon Tonnes)")+
ggtitle ( "Top 5 Feed Producers since 1961")+
theme_bw()+theme(axis.text.x = element_text(size=6, angle=90),
plot.title = element_text(hjust = 0.5),
panel.grid = element_blank(),
legend.title = element_blank())
The largest feed producers are China, USA and Brazil.Above graph also shows continous rise in China’s feed production in last 5 year as compared to USA.
Now we will analyse most produced items in food and feed section.
#Top 5 food producers since 1961
topFoodI5 <- FAO1 %>%
gather(Year, Production, Y1961:Y2013, na.rm = TRUE) %>%
group_by(Element,Item)%>%
filter(Element == "Food") %>%
summarise(totalp = sum(Production)/1000)%>%
ungroup()%>%
top_n(5,totalp)
topFoodI5Y <- FAO1 %>%
gather(Year, Production, Y1961:Y2013, na.rm = TRUE) %>%
group_by(Year,Element,Item)%>%
filter(Element == "Food") %>%
summarise(totalp = sum(Production)/1000)
topFoodI5 %>% select(Item,totalp) %>% arrange(desc(totalp))
## # A tibble: 5 x 2
## Item totalp
## <chr> <dbl>
## 1 Milk - Excluding Butter 38211.
## 2 Cereals - Excluding Beer 36404.
## 3 Vegetables 23359.
## 4 Vegetables, Other 18284.
## 5 Wheat and products 15766.
# Plot year wise production of top 5 produces
topFoodI5Y %>%
filter(Item %in% topFoodI5$Item)%>%
ggplot(aes(Year,totalp,group = Item,color = Item))+
geom_line(size = 1) + xlab("Item")+
ylab( "Production (in millon Tonnes)")+
ggtitle ( "Top 5 Food Item since 1961")+ theme_bw()+theme(axis.text.x = element_text(size=6, angle=90),
plot.title = element_text(hjust = 0.5),
panel.grid = element_blank(),
legend.title = element_blank())
Cereals and Milk are the largest produced food items since 1961.
Similarly let’s figure out about feed items.
# Top 5 feed Items since 1961
topFeedI5 <- FAO1 %>%
gather(Year, Production, Y1961:Y2013, na.rm = TRUE) %>%
group_by(Element,Item)%>%
filter(Element == "Feed") %>%
summarise(totalp = sum(Production)/1000)%>%
ungroup()%>%
top_n(5,totalp)
topFeedI5 %>% select(Item,totalp) %>% arrange(desc(totalp))
## # A tibble: 5 x 2
## Item totalp
## <chr> <dbl>
## 1 Cereals - Excluding Beer 28480.
## 2 Maize and products 16125.
## 3 Starchy Roots 7013.
## 4 Milk - Excluding Butter 6803.
## 5 Barley and products 4013.
# Plot year wise production of top 5 produces
topFeedI5Y <- FAO1 %>%
gather(Year, Production, Y1961:Y2013, na.rm = TRUE) %>%
group_by(Year,Element,Item)%>%
filter(Element == "Feed") %>%
summarise(totalp = sum(Production)/1000)
topFeedI5Y %>%
filter(Item %in% topFoodI5$Item,5)%>%
ggplot(aes(Year,totalp,group = Item,color = Item))+
geom_line(size = 1) + xlab("Item")+
ylab( "Production (in millon Tonnes)")+
ggtitle ( "Top 5 Feed Item since 1961")+
theme_bw()+theme(axis.text.x = element_text(size=6, angle=90),
plot.title = element_text(hjust = 0.5),
panel.grid = element_blank(),
legend.title = element_blank())
Cereals are the most producded feed items with continous rise in production since 1961.
Let’s get a overall view of production of all items since begining .
#Production of food items over the years
topFoodI5Y %>% ggplot(aes(x = Item, y =Year , fill = totalp)) +
geom_tile()+scale_fill_viridis_c(direction = -1) +
theme(aspect.ratio = 0.5 ,axis.text.y = element_text(size=5),
axis.ticks.y = element_blank(),
axis.text.x= element_text(size=7,angle=90),
plot.title = element_text(hjust = 0.5),
legend.title = element_blank())+
ylab("Year") + xlab("Food Items")+
ggtitle("Production of Food items over years")
Apart from top five most produced food items,Starchy Roots,Sugar ,Sweetners, Fruits,Potato and products ,Onions,Oil Crops,Fish,Seafood,Eggs,Meat,Beer,Alcoholic Beverages have considerable increase in production.
#Production of feed items over the years
topFeedI5Y %>% ggplot(aes(x = Item, y =Year , fill = totalp)) +
geom_tile()+scale_fill_viridis_c(direction = -1) +
theme(aspect.ratio = 0.5 ,axis.text.y=element_text(size=5),
axis.text.x= element_text(size=7,angle=90),
plot.title = element_text(hjust = 0.5),
panel.grid = element_blank(),
legend.title = element_blank())+
ylab("Year") + xlab("Feed Items")+
ggtitle("Production of Feed items over years")
Apart from top five most produced feed items,Starchy Roots,Sweet potatoes, Sugar Crops,Rice(Milled Equivalent),Pelagic Fish,Oilcrops,Fish,Cassava and products and Barley and products have considerable rise in production .
Also Spices,Sesameseed Oil,Sesameseed,Cocoa Beans and Products, Cloves and Bovine Meat are included as feed items from year 1992.