Installing and Loading Packages

R packages are add-ons that extend what R can do. They contain pre-written code, functions, and tools for specific tasks. The benefits of using packages are:

In this training, we will be using packages to help reorganise and tidy data, to process network analyses, to produce clean, readable visualisations, and to produce a report.

To install a package, either head to the packages tab in RStudio, find the package and use the intuitive user interface to install them, or use the following command in the console:

install.packages()

The name of the package you want to install goes in quote marks inside the parentheses.

To load the package into your session, you should use the following command in the console:

library()

The name of the package goes into the parentheses, but does not need to be in quote marks.