Functions in R
Lecture Slides Lecture Slides (pdf) Lecture Slides (ipynb)
Tutorial Exercise Tutorial Exercise (pdf) Tutorial Exercise (ipynb)
Functions are the core building blocks of a program written in any language. In this week we discuss the fundamentals of function definition and invocation in R. We also look at the concept of scoping and how it affects the way we write and use functions.
Required Readings
- Peng Chs 15 Functions, 16 Scoping Rules;
- Wickham Chs 6 Functions, 7 Environments;
Additional Readings
- Wickham Chs 9 Functionals, 10 Function Factories, 11 Function Operators.
Tutorial
- Creating functions in R.