Chapter 21. Creating a package

This chapter covers

  • Creating the functions for a package
  • Adding package documentation
  • Building the package and sharing it with others

In previous chapters, you completed most tasks by using functions that were provided by others. The functions came from packages in the base R installation or from contributed packages downloaded from CRAN.

Installing a new package extends R’s functionality. For example, installing the mice package provides you with new ways of dealing with missing data. Installing the ggplot2 packages provides you with new ways of visualizing data. Many of R’s most powerful capabilities come from contributed packages.

Technically, a package is simply a set of functions, documentation, and ...

Get R in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.