Like any other package in R, if you have not installed/used it before on your machine, you will need to install it using the install.packages() command.

Simply type the following code in your console:

install.packages("ggplot2")



Then use the following line to activate ggplot2 everytime you restart R:

library(ggplot2)



Always remember that you will find plenty of help in the documentation of the package. To access it, type:

?ggplot2

A window with links and references will pop up in Rstudio.