Chapter 13 Iteration
This chapter concludes the part on programming.
Having learned to write our own functions and to use conditionals for disinguishing cases, we will learn how to use iteration (or loops) to execude code repeatedly.
Preparation
Recommended background readings for this chapter include:
Chapter 12: Iteration of the ds4psy book (Neth, 2022a).
Chapter 21: Iteration of the r4ds book (Wickham & Grolemund, 2017).
Preflections
To reflect upon the notion and uses of iteration, try answering the following questions:
What does the word iteration mean?
Why and when do we want to execute code repeatedly?
What other means of repeating code do we have?
References
Neth, H. (2022a). Data science for psychologists. Social Psychology; Decision Sciences, University of Konstanz. https://bookdown.org/hneth/ds4psy/
Wickham, H., & Grolemund, G. (2017). R for data science: Import, tidy, transform, visualize, and model data. O’Reilly Media, Inc. http://r4ds.had.co.nz