Week 8 Overview

Published

2025-08-11

This wraps up the content for week 7. Now we require some practice! You should head back to our Moodle site to check out your assessment for this week.

This week we’ll start off with a recap, and then introduce the apply() functions from Base R, and the (mostly) equivalent tidyverse options from the purrr package. We will then get into advanced function writing and querying APIs.

Week 8 Additional Readings/Learning Materials

apply() family and Function Material

Advanced R Chapters

Chapters 7 & 8 from Modern R with Tidyverse

purrr

R for Data Science: Chapter 26.3.3

Week 8 Learning Objectives

Upon completion of this week, students will be able to:

  1. write an R function that has default arguments, allows for additional arguments, and returns a well-structured named object

    1. determine appropriate uses for the stop function
    2. develop a pipeable function that acts on a data frame and one that produces side effects
    3. create a custom infix function
  2. define environments including temporary environments

    1. summarize the order in which R attempts to find a requested object
    2. sketch out the R environment framework and explain the idea of lexical scoping
    3. discuss the concept of local variables and local environments as compared to global variables and environments
    4. state the naming conventions for R objects
  3. program using the “apply family” of functions and the purrr packing in R

    1. differentiate between the apply family of functions in R including, but not limited to, mapply, sapply, lapply, apply, and replicate
    2. manipulate R code that uses loops to instead use the proper apply function
    3. utilize anonymous functions in calls to the apply family of functions in R
    4. use functions from purrr to perform data manipulations
  4. describe what an anonymous function is and how it differs from other functions

Use the table of contents on the left or the arrows at the bottom of this page to navigate to the next learning material!