Loops in R

Last updated on 2024-07-11 | Edit this page

Estimated time: 30 minutes

Overview

Questions

  • How can I do the same thing multiple times more efficiently in R?
  • What is vectorization?
  • Should I use a loop or an apply statement?

Objectives

  • understand loops types and create them
  • identify and perform vectorized operations
  • identify and understand when to use loops or vectorized operations

FIXME

Key Points

  • loops consume computer resources and should be used sparingly
  • R has vectorized operations to make classical looping operations faster