Intro to R
  • Home
  • Syllabus
  • Lectures
  • Homework
  • Software Setup

On this page

  • Info and Materials
  • Learning Objectives
  • Before Class
  • Readings

Lecture 11: Control Flow 3

Published

July 31, 2025

Info and Materials

  • Date: July 31, 2025
  • Topics: Writing Loops Part 2
  • Slides: View Slides
  • Code: No in-class code to download

Learning Objectives

  • Use for loops in a data frame
  • Identify and apply alternatives to for loops in R, such as map(), across(), and apply()
  • Understand when and how to use while loops for condition-based iteration

Before Class

  • Review Lecture 10 materials to get ready for today’s in-class quiz
  • Bring your laptop to every class

Readings

Skim the readings before or after class to get the big picture and prep for quizzes and assignments:

  • “Chapter 26 Iteration” from “R for Data Science” 2nd Edition