This repository hosts the R-Shiny code to download and visualise data stored in the FEAST Global Data Repository. There are two seperate applications for download and visualise functions.
On an Ubuntu GNU/Linux system, install R (>4.0.0) and follow this guide
$ sudo apt install r-base
$ sudo su - -c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\""
Follow instructions in the Shiny-server wiki.
Run and test your Shiny-server implementation:
$ sudo systemctl start shiny-server
For troubleshooting, see the Shiny-server administrator's guide.
Install R package dependencies
$ sudo apt install build-essential libfontconfig1-dev libcairo2-dev gfortran libcurl4-openssl-dev libssl-dev libgit2-dev libudunits2-dev libxt-dev gdal-bin libgdal-dev
Install R packages:
$ sudo su -
# R -e "install.packages(c('RMariaDB', 'DBI', 'pool', 'dplyr', 'ggplot2', 'DT', 'devtools', 'shinyjs', 'openxlsx', 'leaflet', 'wesanderson', 'ggthemes', 'ggsci', 'cowplot', 'plotly', 'shinydashboard', 'shinyWidgets', 'dbplyr', 'svglite', 'Cairo', 'jsonlite', 'raster', 'sf', 'readr', 'shinydisconnect'), repos='https://cran.rstudio.com/')"
Alternative to sf: exactextractr
and geojsonsf
(more efficient than sf_read).
Enter the database name, host, username and password in the two Global.R
files.
Change file permissions recursively for www folders in Downloads and Visualise
Test application in R:
$ R
> library(shiny)
> runApp(/srv/Shiny/Download/, launch.browser = F)
This research was conducted as part of the CGIAR Research Program on Livestock and is supported by contributors to the CGIAR Trust Fund. CGIAR is a global research partnership for a food-secure future. Its science is carried out by 15 Research Centers in close collaboration with hundreds of partners across the globe.