install.packages()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:
- you do not have to write everything from scratch
- work faster and more effectively
- your workflows are easier to reproduce
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:
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.