An Introduction to Writing Loops in R for Efficient Statistical Analyses

Loops can be used in a variety of ways to tackle statistical analyses that would be overwhelming otherwise. For instance, loops can be used to run a particular model or produce a series of figures over a sequence of variables. In this workshop, we will cover several examples in which loops are utilized to make analyses more efficient and reproducible. In particular, we will cover the following topics:

  • 1. Using loops to resample data
  • 2. Using loops to run multiple statistical models
  • 3. Using loops to generate a series of graphics

This is a hands-on workshop and all methods will be demonstrated using the free statistical software package R. The workshop is intended for participants who have the equivalent of one semester of statistics and some previous experience doing data analysis. It is assumed you are familiar with R at least to the level of our Intermediate R workshop.