logo

Using R Packages

Installing R Packages

install.packages("name")

Where name is package name we want to install.

For example let us try to install the “ggplot2” package which is used to produce nicer looking graphs.

install.packages("ggplot2")

Alternatively, we can install a new package in RStudio using the Packages window.

Packages > Install > Type the desired package name > Hit "Enter"

Load a Package

library("name")

Where name is package name we want to load.

Alternatively, we can load a new package in RStudio using the Packages window.