knitr::opts_chunk$set(echo = TRUE)

require(tidyverse)
require(readxl)
require(sringr)
require(ggplot2)

source("../R/general_helper_functions.R")

AQUASTAT

aquastat <- load_csv_from_googledrive("10H8QEJW7QCuAYn4OBMA-h58dE0FckTeq")

unique(aquastat$`Variable Name`)

Let's start by looking at some of the national level variables that get at total area devoted to Ag

aquastat %>% 
  filter(`Variable Name` %in% c("Arable land area",
                                "Permanent crops area",
                                "% of total country area cultivated",
                                "Total agricultural water managed area")) %>% 
  ggplot(aes(x = Year, y = Value, col = Area)) + 
    geom_line(size = 1.2) +
    theme_classic() +
    facet_wrap(.~`Variable Name`, ncol = 2, nrow = 2,
               scales = "free_y") +
    labs(col = "Nation") +
    theme(axis.text = element_text(size = 12),
          axis.title = element_text(size = 14),
          legend.position = "bottom")

WHO Schisto

who_schisto <- load_csv_from_googledrive("1twn-KM3AagRMdCjj4YgaVIotxZL-o_58")

who_schisto %>% 
  dplyr::select(Country, Year, `Population requiring PC for SCH annually`, `National coverage`) %>% 
  mutate(`Population requiring PC for SCH annually` = as.numeric(gsub(",","",`Population requiring PC for SCH annually`)),
         `National coverage` = as.numeric(gsub("%","",`National coverage`))) %>%  
  gather("Variable", "Value", `Population requiring PC for SCH annually`:`National coverage`) %>%
  ggplot(aes(x = Year, y = Value, col = Country)) +
    geom_line(size = 1.2) +
    theme_classic() +
    facet_wrap(.~Variable, nrow = 2,
               scales = "free_y") +
    labs(col = "Nation") +
    theme(axis.text = element_text(size = 12),
          axis.title = element_text(size = 14),
          legend.position = "bottom")

EPAR Agricultural Development Indicator (derivative of LSMS-ISA)

#Download spreadsheet directly from github repository  
tmp <- tempfile(fileext = ".xlsx")
download.file("https://github.com/EvansSchoolPolicyAnalysisAndResearch/335_Data-Dissemination/raw/master/EPAR_UW_335_AgDev_Indicator_Estimates.xlsx",
              destfile = tmp, mode = "wb")

epar <- read_xlsx(tmp, sheet = "Estimates by Instrument")

epar %>% 
  filter(`Variable Name (in the .dta file)` == "use_inorg_fert" &
           Geography %in% c("Ethiopia", "Nigeria", "Tanzania")) %>% 
  mutate(year = as.numeric(str_split(Year, "-", simplify = T)[,1])) %>% 
  ggplot(aes(x = year, y = Mean, col = Geography)) +
    geom_line(size = 1.2) +
    ylim(c(0,1)) +
    theme_classic() +
    labs(x = "Year",
         y = "Proportion households using inorganic fertilizer",
         col = "Nation")


cmhoove14/AgSchistOverlap documentation built on Nov. 18, 2019, 6:56 a.m.