Lesson 20: Writing Functions and Packages

Overview Section

In this chapter of Essential R we'll take a look at writing functions, debugging them, and also at creation of packages.

Objectives

Upon completion of this lesson, you should be able to:

  • Write simple functions with default arguments
  • Control how values are returned by your function
  • Debug a function
  • Recognize and prevent some common errors in user-created functions
  • Create a simple package

The R code file and data files for this lesson can be found on the Essential R - Notes on learning R page.