9) Functions

📖 Lecture

This week we review the syntax used by R for writing functions.

🎯 Objectives

At the end of this week you will be able to:

  • Describe the main parts of a function in R (i.e. anatomy of a function)
  • Give a simple example for creating a function
  • Explain the difference between positional arguments, and named arguments
  • Provide an example for creating a “binary operator” (or infix) function

📚 Reading

🔬 Lab

Work writing some functions.