2.3 R packages

An R package is a collection of functions, data, and documentation that extends the capabilities of R. They are written by a world-wide community of R users. For example, among the most popular packages are:

  • ggplot2 package for data visualization
  • dplyr package for data wrangling
  • tidyverse, which is a package that includes a collection of multiple packages (including the preceding two) that are all installed at once. We’ll be using this package in the course.

There are two key things to remember about R packages:

  • Installation: Most packages are not installed by default when you install R and RStudio. You need to install a package before you can use it. Once you’ve installed it, you likely don’t need to install it again unless you want to update it to a newer version of the package.

  • Loading: Packages are not loaded automatically when you open RStudio. You need to load them everytime you open RStudio.