Have you ever used an Excel add-in?
There are lots of awesome Excel add-ins. My favorite is Jon Acampora’s Pivot Pal add-in.
At its most basic, Excel add-ins are programs that augment the functionality of base Excel. Pivot Pal, for example, adds new functionalities to PivotTable analysis.
Guess what? Packages do for R what add-ins do for Excel — except they are easier to install, and they’re free.
Packages — R’s Thriving Code Aftermarket
R is an open-source platform. That means that not only is the program free, but it’s easy to build on top of.
There’s something called base R. This is the series of code built into R upon install.
Then there are R packages. If base R is your car, R packages are all the cool aftermarket pieces you put in your car to make it even more powerful.
Packages and Libraries, Oh My!
You may hear the term R library and R package used interchangeably — maybe even from me! While colloquially most will understand your meaning, there is a difference.
Packages are collections of R functions, data, and compiled code in a well-defined format. The directory where packages are stored is called the library.
A simple example
The below code shows you how to install the XLConnect package on your computer — this is an awesome package for Excel users. Two functions are involved: installing the package, then calling the library.
Going back to our car analogy, imagine installing the package is like putting the aftermarket piece on your car, and calling the library is like activating that piece each time you want it used on your car.
How am I doing?