library() and give it the name of the package you want to install. To load ggplot2, run:
The package must already be installed on the computer.
Most of the recipes in this book require loading a package before running the code, either for the graphing capabilities (as in the ggplot2 package) or for example data sets (as in the MASS and gcookbook packages).
One of R’s quirks is the package/library terminology. Although you use the
library() function to load a package, a package is not a library, and some longtime R users will get irate if you call it that.
A library is a directory that contains a set of packages. You might, for example, have a system-wide library as well as a library for each user.