Loading a Package from Your Hard Drive

If you need a package that is in your R installation but not loaded into memory yet, you can load it using the library() function. For instance, suppose you wish to generate multivariate normal random vectors. The function mvrnorm() in the package MASS does this. So, load the package as follows:

> library(MASS)

The mvrnorm() function will now be ready to use. And so will its documentation (before you loaded MASS, entering help(mvrnorm) would have generated an error message).

Get The Art of R Programming 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.