Skip to content

Latest commit

 

History

History
101 lines (69 loc) · 3.29 KB

INSTALL.md

File metadata and controls

101 lines (69 loc) · 3.29 KB

Installation / replication steps

Depending on your own system setup you may not need to do all of this. This assumes you are starting from nothing (not even a sytem running R, but a lowest-common-denominator cloud hosted linux instance).

If you already have some sort of system, possibly running R already, you should probably start from step 2, 5, or 7. The library installs etc will vary depending on your package manager. We may eventually set up a docker image for the project to avoid this.

WARNING: The first three steps create an insecure RStudio Server instance with default password that anyone can log in to. This purely for ease of instruction. If you follow these steps from the beginning, you should secure your instance behind a firewall and change the RStudio password.

  1. If necessary create your VM, for example I used the default AWS EC2 image.
  • allocate public IP address
  • open incoming TCP port 8787 in AWS console security group
  1. Install docker
  1. Launch docker with R Studio (based on this guide)
docker run --rm -p 8787:8787 rocker/verse
  1. Connect to your VM instance (e.g. if on AWS, ssh in from another local terminal). Then at the remote shell, connect do Docker:
# Get the container-id
docker ps
# Use the reported container-id below
docker exec -it <container-id> bash
  1. install some system packages. From with the docker shell (if pasting these as a block fails, try pasting one-by-one)
apt-get update

# for mogrify
apt-get install imagemagick php-imagick -y

# for proj4
apt-get install libproj-dev proj-data proj-bin -y

# for rgdal
apt-get install libgdal-dev python-gdal gdal-bin -y

# for pdftools
apt-get install libpoppler-cpp-dev -y
  1. Connect to RStudio at your VM's address port 8787. Login as 'rstudio' pass 'rstudio'.

  2. Install some standard packages the base docker image lacks. In RStudio console

install.packages(c("countrycode","ggalluvial","ggmosaic","pdftools","png","proj4"  ,"readstata13","rgdal", "OECD"))
  1. Clone the repo. In RStudio terminal
git clone https://github.com/worldbank/sdgatlas2018.git
  1. Install some development packages we created. In RStudio console:
devtools::install_github("worldbank/wbgviz", subdir = "wbgdata")
devtools::install_github("worldbank/wbgviz", subdir = "wbgcharts")
devtools::install_github("worldbank/wbgviz", subdir = "wbgmaps")
devtools::install_github("worldbank/wbgviz", subdir = "wbggeo")
  1. As of now ggtreemap doesn't work with the latest treemapify, so in RStudio console:
devtools::install_version("treemapify", version = "2.4.0")
devtools::install_github("econandrew/ggtreemap")
  1. If you want to use the nearest open fonts
  • In RStudio console
extrafont::font_import(system.file("fonts", package = "wbgcharts"))
  • You will also need to install these fonts at system level (OS dependent)
  1. Update the cached API data so everything runs smoothly. In RStudio console
wbgdata::refresh_wbcache()
  1. Open the sdgatlas2018 project in RStudio

  2. In RStudio console, the following we remake all figures from scratch.

source("make.R")
make_all("docs", styler = style_atlas_open)