Appendix B. Installing and Using Packages

image with no caption

One of the major strengths of R is that thousands of user-written packages are available on the Comprehensive R Archive Network (CRAN) at the R home page, http://www.r-project.org/. Package installation is easy in most cases, but there are nuances to be aware of for some of the specialty packages.

This appendix starts with some package basics and then explains how to load R packages from your hard drive and from the Web.

R uses packages to store groups of related pieces of software. The packages that are included with the R distribution are visible as subdirectories of your library directory in your R installation tree, as in /usr/lib/R/library.

Some packages are loaded automatically when you start R, such as the base subdirectory. However, in order to save memory and time, R does not load all available packages automatically.

You can check which packages are currently loaded by typing this:

> .path.package()