Chapter 25 Why write functions?

Much of the heavy lifting in R is done by functions. They are useful for:

  1. Performing a task repeatedly, but configurably;

  2. Making your code more readable;

  3. Make your code easier to modify and maintain;

  4. Sharing code between different analyses;

  5. Sharing code with other people;

  6. Modifying R’s built-in functionality.

%0 1:e->4:w 2:e->4:w 3:e->4:w 4:e->5:w 1 Argument 1 2 Argument 2 3 Argument 3 4 Data processing Function 5 Return value