Preface
This book introduces the R programming language for the analysis of economic data. Economics is an increasingly empirical discipline, and the ability to work with data has become essential for students and practitioners alike. R provides a powerful, flexible, and free environment for statistical analysis, data visualization, and econometric modeling. This book began based on notes I used in my Introductory Macroeconomic Analysis course at Boston University as well as materials I’ve used to help tutor students in undergraduate econometrics. Over time, I have updated much of the code and added new datasets and examples.
About the Examples and Datasets
I have made an effort to include examples and datasets pertinent to different branches of economics. These include:
Macroeconomic time series data: Historical U.S. data on GDP, unemployment, inflation, interest rates, and other indicators dating back to 1929. This is the kind of data you encounter in any introductory macroeconomics course.
State-level cross-sectional data: Census data on income, education, poverty, and demographics across U.S. states. This is useful for exploring regional variation and practicing cross-sectional analysis.
Individual-level microdata: A sample from the American Community Survey’s Public Use Microdata Sample (PUMS), with information on wages, education, employment, and demographics for thousands of individuals. This is the kind of data used in labor economics and applied microeconomics.
Transaction-level business data: Simulated café sales data with nearly 500,000 transactions over five years. This illustrates the kind of data you might encounter in business analytics or industrial organization.
The goal is to give you practice with the different data structures and questions that arise across the discipline.
Downloading the Data
All datasets used in this book are available for download from the book’s GitHub repository:
https://github.com/ackleycb/intro_to_R
To download the data:
- Navigate to the repository link above
- Click on the
datafolder - Click on the file you want to download (e.g.,
us_macrodata.csv) - Click the “Download” button (or right-click “Raw” and select “Save link as…”)
Alternatively, you can download all files at once by clicking the green “Code” button on the main repository page and selecting “Download ZIP.” This will give you the entire repository, including all datasets and the source files for this book.