Repetitive Tasks and Functional Programming
Content for Wednesday, August 31, 2022
Readings
Functions - from Wickham et al., R for Data Science (Wickham and Grolemund 2016) describes the logic of functions and how to approach them with R and the tidyverse.
Iteration - from Wickham et al., R for Data Science (Wickham and Grolemund 2016) provides an introduction to iteration using for loops and then builds on that to introduce the map family of functions.
The Apply Family - from the UC Business Analytics R Programming Guide provides a nice reference on the apply family. These functions are very powerful, but their syntax isn’t as intuitive.
Objectives
By the end of today, you should be able to:
Describe the benefit of functions
Describe the basic components of functions
Design your own simple functions
Use the
applyandmapfamilies of functions to automate repetitive tasks
Slides
The slides for today’s lesson are available online as an HTML file. Use the buttons below to open the slides either as an interactive website or as a static PDF (for printing or storing for later). You can also click in the slides below and navigate through them with your left and right arrow keys.
View all slides in new window Download PDF of all slides