diff --git a/EFA debug.R b/EFA_debug.R similarity index 99% rename from EFA debug.R rename to EFA_debug.R index f987d4f..7d6db05 100644 --- a/EFA debug.R +++ b/EFA_debug.R @@ -1,4 +1,4 @@ -source("EFA functions.R") +source("EFA_functions.R") require(data.table) CountriesChoice<-c("Kenya","Burundi","Tanzania","Uganda","Rwanda") diff --git a/EFA functions.R b/EFA_functions.R similarity index 100% rename from EFA functions.R rename to EFA_functions.R diff --git a/EFA markdown.Rmd b/EFA_markdown.Rmd similarity index 99% rename from EFA markdown.Rmd rename to EFA_markdown.Rmd index 50d29f5..d61d8a3 100644 --- a/EFA markdown.Rmd +++ b/EFA_markdown.Rmd @@ -12,37 +12,33 @@ runtime: shiny margin-right: auto; } - -```{r Setup, include=FALSE} -#knitr::opts_knit$set(root.dir = "C:/AICCRA_EFA") -#knitr::opts_knit$set(root.dir = getwd()) -knitr::opts_chunk$set(echo = F) -``` ```{r Setup - load packages,echo=F,message=FALSE} -if(!require("pacman", character.only = TRUE)){install.packages("pacman",dependencies = T)} - -required.packages <- c("colourpicker", - "data.table", - "dplyr", - "DT", - "FAOSTAT", - "jrvFinance", - "raster", - "RJSONIO", - "rgdal", - "terra", - "shiny", - "sf", - "viridis") - -pacman::p_load(char=required.packages,install = T,character.only = T) + +library(colourpicker) +library(data.table) +library(dplyr) +library(DT) +library(FAOSTAT) +library(jrvFinance) +library(raster) +library(RJSONIO) +library(rgdal) +library(terra) +library(shiny) +library(sf) +library(viridis) +library(knitr) options(scipen = 999) ``` +```{r Setup - chunk options, include=FALSE} +knitr::opts_chunk$set(echo = F) +``` + ```{r Setup - source functions,echo=F,message=FALSE} -source("EFA functions.R") +source("EFA_functions.R") ``` ## AICCRA - Economic and Financial Analysis Tool (EFAt) {.tabset .tabset-fade .tabset-pills} @@ -428,7 +424,7 @@ CellSize.ha<-terra::cellSize(BaseRaster,mask=T, unit="ha") CountryRast<-terra::rasterize(CGIAR_countries,BaseRaster,"ADMIN") CountryAreas<-data.table( terra::zonal( - x=terra::cellSize(CountryRast,mask=T,"ha"), + x=terra::cellSize(CountryRast,mask=T, unit="ha"), z=CountryRast, sum))