Setup

Get your environment ready before class — about 15–30 minutes

← Back to the course

TipDo this before class

Installing R packages and KITE over conference Wi-Fi is the one thing guaranteed to go wrong. Run the steps below at home — total time ~15–30 min including package installation.

1 · System requirements

Tool Minimum Note
R 4.3+ RStudio optional; we run scripts from the command line
GNU Make any macOS and Linux have it; Windows users can install via WSL or Rtools
git 2.30+ for cloning the repo
TeX Live full only needed to rebuild the slides locally

On macOS: brew install r make git. On Debian/Ubuntu: sudo apt install r-base build-essential git.

2 · Clone the repo

git clone https://github.com/julianhinz/economics-of-sanctions.git
cd economics-of-sanctions

3 · Install R and the packages

R ≥ 4.3, plus the packages below (they also install on first run via pacman::p_load(), but doing it now avoids the Wi-Fi gamble):

install.packages("pacman")
pacman::p_load(data.table, magrittr, stringr, fixest, ggplot2,
               scales, arrow, countrycode, remotes, rnaturalearth, sf)
remotes::install_github("julianhinz/KITE", ref = "release/26.05", upgrade = "never")

4 · Get the prepared data

  • Exercise 2 (KITE) ships its initial conditions inside the repoexercises/02-kite-russia/input/initial_conditions/initial_conditions_ICIO_2022.rds. Nothing to download.
  • Exercise 1 (Colombia) needs the prepared customs bundle colombian_trade.csv.gz. Download it from cdn.jhi.nz/data/colombian_trade.csv.gz and drop it at exercises/01-colombia-venezuela/input/colombian_trade.csv.gz. (You can also regenerate it yourself by running make in that exercise, which scrapes the DANE catalog directly — slow, but credential-free.)

5 · Smoke test

cd exercises/01-colombia-venezuela && make estimate
cd ../02-kite-russia              && make baseline

If both run without error, you are ready. See Session 2 and Session 3 for what each pipeline does.

6 · Troubleshooting

  • pacman install fails — use install.packages("pacman", repos = "https://cloud.r-project.org").
  • fixest is slow on the first run — it links to OpenMP; later runs are fast.
  • KITE fails to install — install remotes and Rcpp first, then retry.
  • Out of memory — Exercise 2 uses ~6 GB at peak. Close other apps.