Resources

Here I have compiled a list or a commented bibliography, if you will, of resources that I have found useful along the course of my academic studies. By no means I am an expert on these topics but I do believe that these will help some people out. All efforts of this page are dedicated to the memory of my grandfather, Jorge Pazmiño, who wanted a fairer world- I want to believe that by including these I am adding my little grain of salt to that vision. Do contact me for suggestions and comments about these.

Learning R

R through RStudio- one of my longtime friends. Here you will find a list of resources which I believe can help you get started on your adventures with this marvelous software. It should be noted that I am including these resources with a practical rather than technical approach, which might be a little biased toward econometrics, so it is possible that people on other fields find other resources more helpful than others seen here.

Probably the best introduction to the sofware that exists as of now. It has been endlessly recommended by all sorts of experts on R to beginners, and it is probably because it is a clear and practical guide on how to use R for stuff (namely, data science, but I strongly believe this intro is fit for anybody who wants to use R). It will teach you what R is, what it isn't and what does it do best. It is a crash course on five major functions that the language has which are Wrangle, Program, Explore, Model and Communicate. However, because it is an introductory textbook, you'll feel that it only scratches the surface on these three things. In my opinion the "wrangle" part is pretty comprehensive, but if you need more, you'll have to go to other resources. The only difficulty you might find with this book is installing the software, but the next resource will help you with that.

A great tutorial series and overall a great YouTube channel, probably best for those that prefer learning by watching than by reading. Also, I believe that at least for installing a distribution of R and the RStudio GUI it is better to watch videos of other people doing it. Installation of the software might be one of the complications that R has when compared to other software. The tutorial is done on a Mac, but as of right now I have not found that the installation process for a Windows computer is terribly different.

A popular book which very clearly introduces R and simple statistics knowledge. Probably a good guide if you feel you've understood R4DS but still feel unclear how to continue.

If you're here from my GitHub repository and want to start using R to analyze the AmericasBarometer data, this is the tutorial for you. It will give you a very general overview of R and will teach you to do the more specific stuff needed to analyze the AmericasBarometer data. One of the most important things that this tutorial includes is the use of survey desings of the survey package to produce survey-weighted results. Keep in mind it is written in Spanish, so if you can't read Spanish and need help, don't hesitate to contact me.

Unlike R4DS, this book is an intro to programming in R, "powerful R tools for solving data problems", rather than doing the data analysis. Suffice to say this book will teach you about objects, functions, loops, and other programming concepts which are also seen in other languages. A great complement for R4DS, but maybe not as essential.

A collection of written tutorials online. It might overlap with the resources that I posted before, however, this set of tutorials are a bit more technical and focus on Base R rather than the Tidyverse. Good to compliment your knowledge, and I know some of you out there prefer Base R to the Tidyverse.

Another free and amazing book which can serve as a standalone intro to R. Praised by Jeffrey Wooldridge (The G.O.A.T.) himself, this book will teach you about all the R concepts, commands and packages you need to reproduce the text and exercises in Wooldridge's Introductory Econometrics: A Modern Approach. Thus, it will serve as one of the most powerful weapons on an Economics student's arsenal while in school, considering that I've often heard that in econometrics courses the software applications are often neglected. There are other books on this, like the Companion to Applied Regression and Applied econometrics with R, but I've found these to be significantly more advanced.

The most complete guide on how to visualize data on R using the ggplot2 package, but it includes a basic intro to using Base R for graphics. It also has a general intro to R and a short but sweet piece on the pipe operator.

At a certain point you'll want to stop spitting code to the script window and start communicating the results of your analysis to other people, at least to your professor or TA for homework assignments. While URfIE and Dr. Ejdmyr's tutorials give you good advice on how to export results to your report or paper, the best way to communicate results is to be able to mix prose and code to produce dynamic documents on RStudio itself. Some of this is explained in R4DS, but this book delves much, much deeper in all of this. This prose-code workflow is explained with marvelous detail in this book. It will introduce RMarkdown, but most importantly, it will introduce knitr and .Rwd files in the R context. The latter are files which incorporate LaTeX and R, something very powerful and almost indispensable when producing complex documents. I have not found until this day a better exposition of the LaTeX and R integration than this book.

Discusses the use of RMarkdown, a simpler alternative to sweave/knitr document generation in R. A more practical approach to RMarkdown can be seen in the RMarkdown Cookbook by Xie, Dervieux & Riederer (2021). RMarkdown will be the best way to produce the vast majority of documents you want to produce in a dynamic manner, since it allows the output to be Microsoft Word or PDF. Additionally, the existence of RMarkdown notebooks and RPubs makes it very easy to present your code and prose online. However, complex documents with strict formatting guidelines will probably be easier to create using .Rnw files as described in the Dynamic Docs book, especially so if you institution already provides a LaTeX template. RMarkdown might not give you enough power to do complex stuff, although I have heard that the thesisdown and bookdown packages may give you more power to do this. In my opinion, it's simpler to just use LaTeX if you've reached the point where you demand so many things from R, but whatever, de gustibus non est disputandum.

In order to produce research that can be easily reproduced, code that is written clearly and in an ordered manner is necessary. This might be trickier than it sounds, but this resource carefully and concisely presents some coding style guidelines to ensure that the R code you write can be understood by people other than you. The authors also provide us with other style guides, even one by Hadley Wickham.

A crystal-clear introduction to project version control with Git and GitHub. Version control, although a simple premise, has a somewhat difficult implementation with R and in general with anything that is not Microsoft Word or Google Docs. This book offers a very clear introduction to this with a practical approach aimed at complete beginners.

  • Document(s): Cheatsheets

Many people might not have time to look at a book, video tutorial or even their own previous work when trying to do some task in R. This is what Cheatsheets are for: quick reference guides which work best when you already know the concepts and just need a refresher. A good one is Tom Short's R Reference Card but there are tons of Cheatsheets out there. RStudio provides you with quick access to some of these by clicking Help -> Cheat Sheets.

  • Document(s): Manuals

This wouldn't be a complete resource list if I didn't include the actual manuals which can be found here. However, I do believe these are quite technical, even when considering the complete beginner's manual R for Beginners by Emmanuel Paradis. Complete beginners might find them difficult to understand, but I've realized that when facing difficult issues with no apparent solution it is good to carefully read these manuals. The most recommended ones are R Installation and Administration and An Introduction to R.

An absolutely amazing compilation of every applied R book that has ever come into contact with the author. Chances are that if it exists, it's here. If you're looking for a book that especifically discusses a specialized topic you need to work on and you've already learned the basics of the language, look it up on the Big Book. There's even a book on R Programming with Minecraft.

However, there are some field-specific books which are not in the Big Book yet (although they might already be added in the future, since I have asked the author to include them) which I consider to be interesting. They are listed below:

Below I will include some resources that I haven't exactly read but I've heard repeatedly they are important for improving your skills in the language in a general way:

Some advice on academic work with R

Now, some unsolicited advice on what R packages to use for stuff you'd normally do on academic work:

  • The stargazer package for tables- one of the most time-efficient ways of building quick html, text or LaTeX tables for regressions and summary statistics. There are a lot of customizations available and works with many different types of model objects. However, the package is not perfect and already has been criticized for not being extensible and inconsistent layout. I've also found out that it does not work to well when used with knitr in an .Rnw file and that it is immensely difficult to present statistics that are not calculated through the stargazer command itself. However, it should not be completely discarded in my opinion: it probably is a very good way to start presenting tables on homework assignments or relatively simple papers.

  • The modelsummary package is the ultimate alternative to stargazer. I used this package extensively in my bachelor's thesis and found it to be amazing. It can support virtually all R model objects and allows endless customizations for the tables. One amazing feature is that you can pass kable arguments to the modelsummary function, which are particularly useful for complex tables. One example is the longtable = T argument, which isn't a builtin argument of modelsummary, but it is an argument for the kable package. Also, this works perfectly with .Rnw documents as well as in RMarkdown files. Very, very recommended and will probably save you time in the long run if you start using this one instead of stargazer when you start to create tables from R output.

  • For some reason, I can't seem to be able to compute average partial effects with survey-weighted binary outcome models (logit and probit) using the typical margins package when the dataset in question has missing values. The only way I could fix this was by implementing this solution (i.e. downloading a fork of the margins package from GitHub). I'm not sure if this has been solved yet, but as of right now (late April 2022) the GitHub issue is still open. So the only way to get APEs from a survey-weighted binary outcome model is through this solution, which is sad because computing APEs this way takes a long time.