chapter  7
18 Pages


ByJohn M. Chambers

This chapter examines the role of packages for extending R. Packages are equally the natural unit to capture the next level, when the new ideas or the new application starts to have some substance and particularly when the extensions may be useful to others. R packages have a structure that encourages documentation. R defines a process for packages to transform the source directory so it can be used in an R session. There are two steps: installation and loading. Recipients of the package would not be required to run the setup step, but seeing it explicitly clarifies the package contents by documenting the setup computations. The installation procedure creates a subdirectory corresponding to the package name in the library directory chosen for the installation. In particular, if one package imports from another, the second package need not be attached unless users are expected to call functions from that package explicitly.