Resources

Manuals and guides worth keeping open while you work. Everything below is free online unless the entry says otherwise. None of it is required reading. Use it when you are stuck, or when you want the long version of something a session covered in five minutes.

Coming from Stata

stata2r puts Stata and R side by side for the same task, using the data.table and fixest packages. If you already think in Stata commands, start here: look up the command you know and read across.

Stata Coding Guide, Julian Reif (University of Illinois). Stata first, but most of it is about problems no language solves for you: folder structure, managing packages so a co-author can reproduce your results, automating tables and figures, and what a journal replication package has to contain. The chapter on calling R from Stata is useful in both directions.

R for Stata Users, Robert Muenchen and Joseph Hilbe (Springer, 2010). A book, not free. It defines R terms in Stata vocabulary, and works the same programs through both languages so you can read them against each other. Dated on the tidyverse, still good on the concepts.

Learning R

R for Data Science, Hadley Wickham, Mine Çetinkaya-Rundel and Garrett Grolemund. The standard free reference for the tidyverse. It covers the same ground as sessions 4 and 5 at more length, and keeps going well past them.

Advanced R, Hadley Wickham. Read the Foundations chapters if you want the formal version of session 2: what an object is, what a class is, how vectors and attributes work, and how S3 dispatch decides which summary() you get.

The tidyverse style guide, Hadley Wickham. Naming, spacing, line breaks, pipe formatting. Adopt its conventions or adopt your own, but adopt something and be consistent. Your future co-authors are reading.

Coding guides

Code and Data for the Social Sciences: A Practitioner’s Guide, Matthew Gentzkow and Jesse Shapiro. About thirty pages on directory structure, automation, version control, and abstraction, written for economists by economists. Widely used in the profession, and short enough to read in one sitting. Read it before your first real project, not after.

Data Science for Economists, Grant McDermott (EC 607, University of Oregon). A full graduate course in the open, lecture notes and code: git, data wrangling, APIs, web scraping, spatial analysis, parallel programming, databases. It goes further than this course in several directions, and the material is free to read.

Coding for Economists, Arthur Turrell (Bank of England). Python rather than R, and useful for exactly that reason: the same problems in a different language, so you can see which parts of what you learn here are about data work and which are about R.

Getting unstuck

Before you search, try the help page: ?function_name in the console, or ??keyword if you do not know the name. Session 2 covers both.

When the help page is not enough, paste the exact error message into a search engine. R’s error messages are terse but they are specific, and somebody has almost certainly hit yours. Stack Overflow and Posit Community carry most of the answers.

For AI assistants, wait for sessions 8 and 9. The course has things to say about when to trust them and how to check what they give you, and the habits are easier to build before you have bad ones.