Better or Worse Job Accessibility? Understanding Changes in Spatial Mismatch: Evidence from Medellín, Colombia
Authors: David Bernal; Gustavo A. García; Jorge Pérez-Pérez
Bernal, D., García, G., and Pérez-Pérez, J. (2025). "Better or Worse Job Accessibility? Understanding Changes in Spatial Mismatch: Evidence from Medellín, Colombia", Journal of Transport Geography, 128:104341
This repository contains all the code used to replicate the results of the paper:
“Better or Worse Job Accessibility? Understanding Changes in Spatial Mismatch: Evidence from Medellín, Colombia.”
All code (except for the final two scripts) is written in R.
-
Data/
Contains all data obtained from external sources, including shapefiles. -
Base/
Stores intermediate files that are entirely generated by scripts. -
Output/
Stores final results:Results/: Data outputs derived from the analysisTex/: Tables formatted for LaTeXFigueres/: Figures based on the results
-
All files in
Base/andOutput/are fully replicable, as they are produced by running the code. -
R scripts are stored outside these folders to maintain a consistent working directory and streamline execution.
-
Start with
Master.R- This is the main script that runs all other scripts in sequence (52 total).
- Scripts must be run in order.
-
Function Scripts
- Some scripts are utility functions (e.g.,
Maps_Function.R). - Ensure they are in the same folder as
Master.R—they are called from other scripts.
- Some scripts are utility functions (e.g.,
-
Working Directory Setup
- Scripts begin with:
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
- This ensures the script uses its own path as the working directory—no need to manually set it.
- Scripts begin with:
-
❌ Do not run Scripts 2 and 3
These download live data from Google and Bing APIs. You need API keys, and results will differ from the paper due to time sensitivity. -
📦 Deprecated R packages
- We use
rgdal, which has been removed from CRAN. - Download it from the archive:
https://cran.r-project.org/src/contrib/Archive/rgdal/ - You must have Rtools installed to build it.
- We use
-
🧰 R Version
- All scripts were tested in R 4.0.3 (64-bit)
- Ensure package compatibility with this version.
-
📊 Stata Scripts
- The final two scripts are written in Stata (version 16+ required).
- Follow the instructions in
Master.Rto run them correctly.
If you have questions or issues replicating the code, feel free to reach out: