In this video we introduce functions in R and how to write them. We begin with functions of a single argument, using a truncation function as an example. Then we proceed to illustrate how to return multiple objects by using a list, functions of two or more arguments, default values for arguments, and the use of argument names when calling a function. The same example (Example 10 in Mod11Script.R) is used throughout the video to develop progressively more sophisticated versions of a truncation function. You should follow along with this example in Mod11Script.R and read and submit code as you watch the video.
This video is essential viewing.