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.