R Programming for Economists

Empirical economic analysis with R — a course on data analysis, visualization, and reproducible research for students at the UNAM School of Economics.

Araceli Martínez-Holguín

Instructor

Araceli Martínez-Holguín is a PhD student in Economics at the School of Economics of the National Autonomous University of Mexico (UNAM).

Her research studies the relationship between extreme climate events and food prices, with broader interests in macroeconomics, monetary policy, and sustainable finance.

In this course she teaches students how to use R to conduct empirical economic analysis and build reproducible research workflows.

Course Overview

This course introduces students to empirical economic analysis using R. Students learn how to clean, visualize, and analyze economic datasets while developing reproducible research workflows.


Laboratories combine programming techniques with applied economic questions using datasets related to climate data, agricultural production, and macroeconomic indicators.

Topics Covered

1
Introduction to R and RStudio — setting up the environment and learning how to write and run code for data analysis.
2
Data Types and Data Structures — understanding vectors, matrices, lists, and data frames as the foundations of data analysis in R.
3
Data Manipulation with dplyr — filtering, transforming, and summarizing datasets to prepare economic data for analysis.
4
Data Visualization with ggplot2 — creating clear and informative graphs to explore patterns in economic data.
5
Economic Data Analysis — applying programming tools to analyze real-world economic datasets.
6
Time Series Analysis — studying the dynamics of economic variables over time.
7
Linear Regression Models — estimating and interpreting basic econometric models using R.
8
Economic Forecasting — using time series tools to generate and evaluate predictions of economic variables.

Course Roadmap

1
Foundations of R — understanding objects, vectors, and data structures.
2
Data Analysis and Visualization — applying data exploration and visualization techniques using climate data from the CRU dataset.
3
Data Manipulation with dplyr — cleaning and transforming agricultural production data to analyze avocado production in Mexico using SIAP datasets.
4
Spatial Analysis in R — combining climate and agricultural datasets to create maps in R and communicate economic and policy-relevant insights.
5
Time Series Analysis in R — using time series methods to explore inflation dynamics and macroeconomic trends.

Laboratories

🔬
Lab 00
Types of Objects in R
Introduction to R data structures
📊
Lab 01
Analyzing Climate Variables
CRU data · precipitation · temperature
🌱
Lab 02 · Coming soon
Agricultural Data with dplyr
SIAP · avocado production in Mexico
🗺️
Lab 03 · Coming soon
Spatial Analysis in R
Maps · climate & agricultural data
📈
Lab 04 · Coming soon
Time Series Analysis
Inflation dynamics · macroeconomic trends

Assignments

📝
Assignment 01
Climate Variables — Homework
Based on Laboratory 01
📝
Assignment 02 · Coming soon
Agricultural Data — Homework
Based on Laboratory 02
📝
Assignment 03 · Coming soon
Spatial Analysis — Homework
Based on Laboratory 03

Data

Datasets used across the laboratories. Download them directly or clone the repository to access all files locally.

How to Use This Repository

Clone the repository:

git clone https://github.com/araceli-martinez-holguin/economics-r-course.git

Open the project in RStudio, navigate to a laboratory folder, open the .Rmd file and run the code or knit the document to reproduce the analysis.