If you want to check which version of ggplot2 has been installed onto your computer, you can run the following command:
library(versions) installed.versions("ggplot2")
The preceding command will show the following output on the console screen:
> installed.versions("ggplot2") Checking package in 'C:/rPackages' (as 'lib' is unspecified) [1] "2.2.0" >
Now, to install the required version of any library, you first need to know the version number and how that has been written in the library documentation. Then, use that version number as follows: