Find Out Which Package Version is Loaded in R (Example Code)
The following R programming syntax illustrates how to find out the package version which is currently loaded in R.
For this tutorial, I’m going to use the dplyr package. Let’s install and load the package to RStudio:
install.packages("dplyr") # Install dplyr package library("dplyr") # Load dplyr package
Now, we can use the packageVersion function to extract the currently loaded version of the dplyr R package:
packageVersion("dplyr") # Check package version of dplyr # ‘0.8.3’
The RStudio console shows the version of dplyr, i.e. the version 0.8.3.
That’s basically it. Just replace the package name with any other package you want to check.
Do you need more explanations on how to find out which package version is loaded in your R library? Then you could check out the following YouTube video, which I have published on my channel. In the video I’m showing the previous example live in RStudio:
Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.
If you accept this notice, your choice will be saved and the page will refresh.
Extract More Information on R Packages
There are several related functions available, which give more information of your installed packages. Two helpful functions are packageDate() and packageDescription().
The packageDate command returns the date of a package. Let’s do this for dplyr:
packageDate("dplyr") # Get date of dplyr # "2019-07-04"
With the packageDescription function, it is also possible to print an extensive description of a package to the RStudio console:
packageDescription("dplyr") # Print whole description of dplyr
Figure 1: Console Output of packageDescription R Function.
On my website, I have published many other R tutorials. In case you want to learn more about R in general, I can recommend to check out the following page:
Also, don’t forget to subscribe to my email newsletter, in case you want to get updates on future tutorials.