install rHow to find out which package version is loaded in R?

5 Answers

You can use packageVersion to see what version of a package is loaded

> packageVersion("snow")
[1] ‘0.3.9’

Although it sounds like you want to see what version of R you are running, in which case @Justin's sessionInfo suggestion is the way to go

r update package

I am in a process of figuring out how to use my university cluster. It has 2 versions of R installed. System wide R 2.11 (Debian 6.0) and R 2.14.2 in non-standard location.

I am trying to use MPI together with snow. The code I am trying to run is the following

cl <- makeMPIcluster(mpi.universe.size()-1)

It works without the problems on R 2.11. (I launch the script with mpirun -H localhost,n1,n2,n3,n4 -n 1 R --slave -f code.R). Now when I try to do it with R 2.14.2, I get the following message:

Error: This is R 2.11.1, package 'snow' needs >= 2.12.1
In addition: Warning message:

So it seems that R loads the package snow version compiled for R 2.11. I've installed snow under R 2.14 into my home folder and I added the following lines to my code:


And the output before the error confirms that I am indeed running R 2.14.2 and my R packages folder is first in search path. But I still get the error.

So my question is how do I determine which version of package is loaded in R? I can see with installed.packages all the packages which are installed, so maybe there is some function which lists similar information for loaded packages?

To check the version of R execute : R --version

Or after you are in the R shell print the contents of version$version.string


To check the version of installed packages do the following.

After loading the library, you can execute sessionInfo ()

But to know the list of all installed packages:

packinfo <- installed.packages(fields = c("Package", "Version"))
packinfo[,c("Package", "Version")]

OR to extract a specific library version, once you have extracted the information using the installed.package function as above just use the name of the package in the first dimension of the matrix.

packinfo["RANN",c("Package", "Version")]
packinfo["graphics",c("Package", "Version")]

The above will print the versions of the RANN library and the graphics library.

GUI solution:

If you are using RStudio then you can check the package version in the Packages pane.

Use the following code to obtain the version of R packages installed in the system:

installed.packages(fields = c ("Package", "Version"))

Search() can give a more simplified list of the attached packages in a session (i.e., without the detailed info given by sessionInfo())

search {base}- R Documentation
Description: Gives a list of attached packages. Search()

#[1] ".GlobalEnv"        "package:Rfacebook" "package:httpuv"   
#[5] "package:httr"      "package:bindrcpp"  "package:forcats"   # 
#[9] "package:dplyr"     "package:purrr"     "package:readr"     
#[13] "package:tibble"    "package:ggplot2"   "package:tidyverse" 
#[17] "package:stats"     "package:graphics"  "package:grDevices" 
#[21] "package:datasets"  "package:methods"   "Autoloads"