Packages are collections of R functions, data, and compiled code in a defined format.
What is the value of these packages? Well, R includes a number of standard functions (analogous to how standard functions are found in Excel), but what if you need a function not in the standard list? Chances are the R community has already developed this function and has wrapped it up in a package. All you have to do is download/install/load the package and now you can immediately take advantage of this new function. New packages become available often and continuously increases the power and functionality of R!
The directory where currently installed packages are stored is called the library. Instuctions to install new packages are provided below. Installed packages must be loaded into the session before being used, instructions provided below.
Viewing Current Packages Packages currently installed can be viewed per the following:
> library()
Packages currently loaded can be viewed per the following:
Installing Standard Packages found in the CRAN repository Default packages in the CRAN repository can be installed with the install.packages function. Note that installation may take a few minutes.
install.packages("PackageName")
EXAMPLE:
> install.packages("MASS")
Installing downloaded packages not found in the CRAN repository Packages not found in the CRAN repository (i.e. those which you have downloaded) can be installed with the install.packages function by specifying the path location. Note that installation may take a few minutes.