Doing Economics in Julia
  • Home
  • Setup
  • R → Julia
  1. Getting started
  2. Setup
  • Getting started
    • Overview
    • Setup
  • Empirical projects
    • 1. Measuring climate change
    • 2. Data from experiments
    • 3. Measuring a sugar tax
    • 4. Measuring wellbeing
    • 5. Measuring inequality
    • 6. Management practices
    • 7. Supply and demand
    • 8. Cost of unemployment
    • 9. Credit-excluded households
    • 10. Banking systems
    • 11. Willingness to pay
    • 12. Hong Kong cash handout
    • Extra 2. Carbon taxation
  • Reference
    • R → Julia
    • Technical reference

On this page

  • 1. Install Julia
  • 2. Install Quarto
  • 3. Instantiate the environment
  • 4. The data is already there
  • 5. Render
  • Working on this in an editor
  • View source
  • Report an issue
  1. Getting started
  2. Setup

Setup

Julia, Quarto, and the data

1. Install Julia

Use juliaup, the official version manager, rather than a bare Julia install — it handles updates and lets you pin a version per project.

  • Windows
  • macOS / Linux
winget install --id Julialang.Juliaup -e --source winget

This comes from winget’s default source, so no Microsoft Store account is involved.

curl -fsSL https://install.julialang.org | sh

Then open a new terminal — the installer edits PATH, and the shell you ran it in won’t have picked that up:

julia --version    # 1.12.x
juliaup status

2. Install Quarto

Project pages are .qmd files: prose with Julia code cells, rendered by Quarto’s native Julia engine.

  • Windows
  • macOS / Linux
winget install --id Posit.Quarto -e --source winget

Download the installer from quarto.org/docs/get-started, or on macOS brew install --cask quarto.

Check that the Julia engine can start. The first run installs QuartoNotebookRunner into a private environment that Quarto owns, so it won’t touch this project’s dependencies or your global one:

quarto --version   # 1.10.x
quarto check julia

3. Instantiate the environment

Manifest.toml is committed, so this resolves to the exact package versions the published figures were produced with:

git clone https://github.com/nehalahmedshaikh/doing-economics
cd doing-economics
julia --project=. -e 'using Pkg; Pkg.instantiate()'

The first run downloads and precompiles the stack — CairoMakie is the slow part, expect a few minutes. Subsequent runs are fast.

Confirm the shared helpers work:

julia --project=. -e 'using Pkg; Pkg.test()'

4. The data is already there

The datasets are committed under data/raw/ — 7.9 MB — so there is no download step. Clone and the projects run offline.

This is deliberate rather than lazy. Project 5’s upstream, the Global Consumption and Income Project site, has been taken over by an unrelated operation; the copy in this repository came from a pre-takeover Internet Archive capture and is the only reliable one left. Any project that depends on a live URL is one dead link from breaking.

data/MANIFEST.toml is the provenance record — publisher, licence, SHA-256 and vintage for each file. To check your working copy against it:

julia --project=. scripts/verify_data.jl       # all of them
julia --project=. scripts/verify_data.jl 1     # just project 1

Some sources are reissued over time — NASA GISS revises its whole temperature record monthly, the World Bank revises continuously. To pull current versions:

julia --project=. scripts/fetch_data.jl        # refresh everything
julia --project=. scripts/fetch_data.jl 1      # refresh project 1

The script enforces the checksum on sources marked frozen and reports drift on the rest, so you can see what moved. Numbers on the rendered pages come from the vintages recorded in the manifest; refreshing may shift them in the last decimal place.

5. Render

quarto render                                              # whole site into docs/
quarto render projects/01-measuring-climate-change/index.qmd   # one project
quarto preview                                             # live-reloading server

Computed output is cached in _freeze/, which is committed. That is what lets the site build in CI without the datasets present — useful given the gated sources above. To force a project to actually re-run, delete its folder under _freeze/ first.

Working on this in an editor

For VS Code, install the Julia and Quarto extensions. The Quarto extension runs individual cells against a persistent Julia session, which avoids paying CairoMakie’s startup cost on every edit.

Overview
1. Measuring climate change
Source Code
---
title: "Setup"
subtitle: "Julia, Quarto, and the data"
engine: markdown
---

## 1. Install Julia

Use [juliaup](https://github.com/JuliaLang/juliaup), the official version manager, rather
than a bare Julia install — it handles updates and lets you pin a version per project.

::: {.panel-tabset}

### Windows

```powershell
winget install --id Julialang.Juliaup -e --source winget
```

This comes from winget's default source, so no Microsoft Store account is involved.

### macOS / Linux

```bash
curl -fsSL https://install.julialang.org | sh
```

:::

Then **open a new terminal** — the installer edits `PATH`, and the shell you ran it in
won't have picked that up:

```bash
julia --version    # 1.12.x
juliaup status
```

## 2. Install Quarto

Project pages are `.qmd` files: prose with Julia code cells, rendered by Quarto's native
Julia engine.

::: {.panel-tabset}

### Windows

```powershell
winget install --id Posit.Quarto -e --source winget
```

### macOS / Linux

Download the installer from [quarto.org/docs/get-started](https://quarto.org/docs/get-started/),
or on macOS `brew install --cask quarto`.

:::

Check that the Julia engine can start. The first run installs
[QuartoNotebookRunner](https://github.com/PumasAI/QuartoNotebookRunner.jl) into a private
environment that Quarto owns, so it won't touch this project's dependencies or your global
one:

```bash
quarto --version   # 1.10.x
quarto check julia
```

## 3. Instantiate the environment

`Manifest.toml` is committed, so this resolves to the exact package versions the published
figures were produced with:

```bash
git clone https://github.com/nehalahmedshaikh/doing-economics
cd doing-economics
julia --project=. -e 'using Pkg; Pkg.instantiate()'
```

The first run downloads and precompiles the stack — CairoMakie is the slow part, expect a
few minutes. Subsequent runs are fast.

Confirm the shared helpers work:

```bash
julia --project=. -e 'using Pkg; Pkg.test()'
```

## 4. The data is already there

The datasets are committed under `data/raw/` — 7.9 MB — so there is no download step. Clone
and the projects run offline.

This is deliberate rather than lazy. Project 5's upstream, the Global Consumption and Income
Project site, has been taken over by an unrelated operation; the copy in this repository came
from a pre-takeover Internet Archive capture and is the only reliable one left. Any project
that depends on a live URL is one dead link from breaking.

`data/MANIFEST.toml` is the provenance record — publisher, licence, SHA-256 and vintage for
each file. To check your working copy against it:

```bash
julia --project=. scripts/verify_data.jl       # all of them
julia --project=. scripts/verify_data.jl 1     # just project 1
```

Some sources are reissued over time — NASA GISS revises its whole temperature record monthly,
the World Bank revises continuously. To pull current versions:

```bash
julia --project=. scripts/fetch_data.jl        # refresh everything
julia --project=. scripts/fetch_data.jl 1      # refresh project 1
```

The script enforces the checksum on sources marked frozen and reports drift on the rest, so
you can see what moved. Numbers on the rendered pages come from the vintages recorded in the
manifest; refreshing may shift them in the last decimal place.

## 5. Render

```bash
quarto render                                              # whole site into docs/
quarto render projects/01-measuring-climate-change/index.qmd   # one project
quarto preview                                             # live-reloading server
```

Computed output is cached in `_freeze/`, which is committed. That is what lets the site
build in CI without the datasets present — useful given the gated sources above. To force a
project to actually re-run, delete its folder under `_freeze/` first.

## Working on this in an editor

For VS Code, install the [Julia](https://marketplace.visualstudio.com/items?itemName=julialang.language-julia)
and [Quarto](https://marketplace.visualstudio.com/items?itemName=quarto.quarto) extensions.
The Quarto extension runs individual cells against a persistent Julia session, which avoids
paying CairoMakie's startup cost on every edit.

Code MIT-licensed. Projects and solutions © CORE Econ.

 
  • View source
  • Report an issue

Built with Quarto and Julia.