This document provides an introduction to control flow in R, including for loops, if/else statements, and vectorization. It discusses how for loops can be slow in R and recommends using vectorized functions instead when possible. It provides examples of if/else, ifelse, while, repeat, and switch statements. It also emphasizes that matrix operations in R are very fast, and shows how to vectorize calculations rather than using for loops in order to efficiently classify US states based on crime rates.