##GENERAL SUMMARIZED INTRODUCTION

This assignment report intends to answer SDG Number 2, which states ‘End hunger, achieve food security and improved nutrition and promote sustainable agriculture’

In the African context, the sure source of food to majority of household is agriculture(Oluwatayo et al., 2016). One of the important entry point to end hunger in Africa is investment in agricultrural innovations(Hanjra et al., 2009). Irrigation is one of the key innovations especially in the drier parts of the continent which rely heavily on rain-fed agriculture(Wanyama et al.,2018)

A more sustainable and uninterepted agricultural flow is essential to combat hunger in Africa. The indicator chosen to see the development towards the SD is amount of water withdrawn for use in agriculture. It follows therefore that, the more the water is withdrawn for irrigation, the stronger the food production from agriculture and the closer the countries are to achieving this particular SD goal. This is because it implies that enough food would be produced. Data show that, in the 1995 and 2000 not much was done interms of investment in Irrigation in Africa and therefore the color in different countries is the same. This may have been caused by less budget alocation to irrigationschemes by country governments. However the level of investments kept changing with North and SouthAfrica showing more effort done in this area. This is shown by the darker blue colors in the maps compared to the more lighter ones. In Tanzania for instance, the agricultural revolution that embraces such innovations was launched in 2009 under the theme’Kilimo Kwanza’(Agriculture first) aiming at producing agricultural reliant and hunger free country(Ngaiza, 2012). However the pace at which the African countries is taking to achieve SD2 still needs to increase

In this exercise the two references provided “women in the world” and “mapping world development indicators” were reproducued and used to get inspiration of code writing and manipulation.

Relevant libraries were then run to call required functions. Then a series of codes were used to upload world data, exctract region specific data(Africa), join the exctracted data to the relevant African shapefile and to map the data in a span of 18years to learn if there are anychanges using ggplot functions.In some instances for example to have data only for East Africa and in the categozation of zones for comparison(in Part b), a downloaded CSV file had to be modified to make it tidy and compartible enough to be read and analyzed

Part I

Results

The lines of codes that were used to produce this output is shown in the processes that follows here;

irr_land <- read.csv("./Data/agricultural-land-irrigation.csv")
length(unique(irr_land$Code))
## [1] 119
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
nirr95 <- filter(irr_land, Year==1995)

nirr00 <- filter(irr_land, Year==2000)

nirr05 <- filter(irr_land, Year==2005)

nirr10 <- filter(irr_land, Year == 2010)

nirr13 <- filter(irr_land, Year == 2013)

names(nirr95) <-   c("Entity", "Code",   "Year",   "Irr_1995")

names(nirr00) <-   c("Entity", "Code",   "Year",   "Irr_2000")

names(nirr05) <-   c("Entity", "Code",   "Year",   "Irr_2005")

names(nirr10) <-   c("Entity", "Code",   "Year",   "Irr_2010")

names(nirr13) <-   c("Entity", "Code",   "Year",   "Irr_2013") 
library(rnaturalearth)
library(sf)
## Linking to GEOS 3.5.1, GDAL 2.1.3, PROJ 4.9.2
library(ggplot2)
library(ggiraph)
world <- sf::st_as_sf(rnaturalearth::countries110)

## str(world)
length(unique(world$iso_a3))
## [1] 175
library(sf)

nworld1 <-  left_join(world, nirr95, by = c('iso_a3' = 'Code')) 

nworld2 <-  left_join(nworld1, nirr00, by = c('iso_a3' = 'Code'))  

nworld3 <-   left_join(nworld2, nirr05, by = c('iso_a3' = 'Code')) 

nworld4 <-   left_join(nworld3, nirr10, by = c('iso_a3' = 'Code'))

nworld <-   left_join(nworld4, nirr13, by = c('iso_a3' = 'Code'))
                   
nworld %>%       st_transform(crs="+proj=laea +lon_0=18.984375")
(nworld$Irr_1995[is.na(nworld$Irr_1995)] <- 0)
## [1] 0
(nworld$Irr_2000[is.na(nworld$Irr_2000)] <- 0)
## [1] 0
(nworld$Irr_2005[is.na(nworld$Irr_2005)] <- 0)
## [1] 0
(nworld$Irr_2010[is.na(nworld$Irr_2010)] <- 0)
## [1] 0
(nworld$Irr_2013[is.na(nworld$Irr_2013)] <- 0)
## [1] 0
world.centers <- st_centroid(nworld)

world.spdf <- methods::as(nworld, 'Spatial')
world.spdf@data$id <- row.names(world.spdf@data)

world.tidy <- broom::tidy(world.spdf)
## Regions defined for each Polygons

This indicator for Africa now

world.tidy <- dplyr::left_join(world.tidy, world.spdf@data, by='id')
africa.tidy <- dplyr::filter(world.tidy, region_un=='Africa')
library(sf)
library(ggplot2)
library(hrbrthemes)
## NOTE: Either Arial Narrow or Roboto Condensed fonts are *required* to use these themes.
##       Please use hrbrthemes::import_roboto_condensed() to install Roboto Condensed and
##       if Arial Narrow is not on your system, please see http://bit.ly/arialnarrow
library(colormap)
irr95 <- ggplot(africa.tidy) +
  geom_polygon_interactive(
    color='black',
    aes(long, lat, group=group, fill=(Irr_1995),
        tooltip=sprintf("%s<br/>%s",iso_a3,Irr_1995))) +
 hrbrthemes::theme_ipsum() +
  colormap::scale_fill_colormap(
    colormap=colormap::colormaps$freesurface_blue, reverse = T) +
  labs(title='Share of Irrigated land in Africa in 1995', subtitle='As a percentage of total farmed land',
       caption='Source: Our World in Data.')

##widgetframe::frameWidget(ggiraph(code=print(g4)))
ggiraph(code=print(irr95))
library(colormap)
irr10 <- ggplot(africa.tidy) +
  geom_polygon_interactive(
    color='black',
    aes(long, lat, group=group, fill=(Irr_2000),
        tooltip=sprintf("%s<br/>%s",iso_a3,Irr_2000))) +
 hrbrthemes::theme_ipsum() +
  colormap::scale_fill_colormap(
    colormap=colormap::colormaps$freesurface_blue, reverse = T) +
  labs(title='Share of Irrigated land in Africa in 2000', subtitle='As a percentage of total farmed land',
       caption='Source: Our World in Data.')

##widgetframe::frameWidget(ggiraph(code=print(g4)))
ggiraph(code=print(irr10))
library(colormap)
irr05 <- ggplot(africa.tidy) +
  geom_polygon_interactive(
    color='black',
    aes(long, lat, group=group, fill=(Irr_2005),
        tooltip=sprintf("%s<br/>%s",iso_a3,Irr_2005))) +
 hrbrthemes::theme_ipsum() +
  colormap::scale_fill_colormap(
    colormap=colormap::colormaps$freesurface_blue, reverse = T) +
  labs(title='Share of Irrigated land in Africa in 2005', subtitle='As a percentage of total farmed land',
       caption='Source: Our World in Data.')

##widgetframe::frameWidget(ggiraph(code=print(g4)))
ggiraph(code=print(irr05))
library(colormap)
irr10 <- ggplot(africa.tidy) +
  geom_polygon_interactive(
    color='black',
    aes(long, lat, group=group, fill=(Irr_2010),
        tooltip=sprintf("%s<br/>%s",iso_a3,Irr_2010))) +
 hrbrthemes::theme_ipsum() +
  colormap::scale_fill_colormap(
    colormap=colormap::colormaps$freesurface_blue, reverse = T) +
  labs(title='Share of Irrigated land in Africa in 2010', subtitle='As a percentage of total farmed land',
       caption='Source: Our World in Data.')

##widgetframe::frameWidget(ggiraph(code=print(g4)))
ggiraph(code=print(irr10))
library(colormap)
irr13 <- ggplot(africa.tidy) +
  geom_polygon_interactive(
    color='black',
    aes(long, lat, group=group, fill=(Irr_2013),
        tooltip=sprintf("%s<br/>%s",iso_a3,Irr_2013))) +
 hrbrthemes::theme_ipsum() +
  colormap::scale_fill_colormap(
    colormap=colormap::colormaps$freesurface_blue, reverse = T) +
  labs(title='Share of Irrigated land in Africa in 2013', subtitle='As a percentage of total farmed land',
       caption='Source: Our World in Data.')

##widgetframe::frameWidget(ggiraph(code=print(g4)))
ggiraph(code=print(irr13))

Referencing

References

Hanjraa, M., Feredeb, T., Guttac, D(2009) “Reducing poverty in sub-Saharan Africa through investments in water and other priorities”. Agricultural Water Management

Oluwatayo, Isaac B. & Ojo, Ayodeji O.“Is Africa’s dependence on agriculture the cause of poverty in the continent?: An empirical review.” The Journal of Developing Areas, vol. 50 no. 1, 2016, pp. 93-102. Project MUSE, doi:10.1353/jda.2016.0016

Ngaiza, R.S(2012) FAO-University of Nairobi -Regional Workshop on an Integrated Policy Approach to Commercializing Smallholder Maize Production, Nairobi.

Wanyama, I., Pelster, D. E., Arias-Navarro, C., Butterbach-Bahl, K., Verchot, L. V., & Rufino, M. C. (2018). Management intensity controls soil N2O fluxes in an Afromontane ecosystem. Science of The Total Environment, 624, 769–780. https://doi.org/10.1016/j.scitotenv.2017.12.081

Part II

To link the SDG 2 and agricultural production and change in food (Cereal) production to combat insecurity. I am looking at it and try to relate the trends with the previous trends in water use in irrigation

First the libraries were called

library(dplyr)
library(tidyr)
library(ggplot2)
library(scales)

Then a sub data frame for selected zones of the world was created from the complete data set and the cereal production situation learnt. The zones selected were the Gulf, Europe, Africa and the oceania

Food_sec <- read.csv("./Data/Cereal_Yield.csv")
ggplot(Food_sec, aes(x = Year, y = Cereal.production)) +
  geom_line() +
   labs( title="Cereal productions in different chosen zones in kg per hectare") +
facet_wrap(~ Country.group)

Figures show that the production of cereals for the stated time was higher in the Gulf, this can be related to higher export potential. There is a low trend in the rest zones, with Africa being related to the lower investment in agricultural intensificatin and innovation, while the reason for the remaining Europe and Oceania coulb be a result of grain preferences

Food_sec1 <- read.csv("./Data/Cereal_Yield_EA.csv")
ggplot(Food_sec1, aes(x = Year, y = Cereal.production, color = Country.name)) +
  geom_line() +
  labs(title="Cereal Yields Trends in EA in Kg per hectare") +
  expand_limits(y = 0)

In East Africa, cerials are the most important staple food sources. This can be shown by very close rates of production partly guied by food preferences. The tropical geographical conditions that do not have very high variations support similar types of agricultural products. This is why the variation is not too big. All production range between 1000 and 1800 kg/ha. The country variations are chiefly due to internal naational agricultural policies. Discussion of two extreme cases show that in Tanzania, the sharp increase between 2005 and 2010 may have been contributed by the Kilimo Kwanza initiative mentioned earlier. The initiative accompanied national agricultural spending increase from 2007 to 2010(including opening up up irrigation fields) and after 2010 the funds declined(Ayrwald et al, 2015). At the moment the initiative has been phased out. In Uganda the afgricultural food markets are highly liberalized and public interventions in agriculture are infrequent, causing heavy investment in agriculture and especially receal production (ibid). This coupled with favourable tropical weather conditions may have been a contributor to an increased cereal production even after the world food crisis of 2008.

References

Aylward, C., Biscaye, P, Panhorst H.K., LaFayette, M., True, Z., Anderson, L. & Reynold, T. (2015). Maize Yield Trends and Agricultural Policy in East Africa Macro-Level Literature Review for Six Countries. EPAR Technical Report No. 310C. University of Washington.USA

End