0 votes
1 view
in R Programming by (7.3k points)

I am in the 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 a non-standard location.

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

library(snow)

library(Rmpi)

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

stopCluster(cl)

mpi.quit()

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:
libPaths("/soft/R/lib/R/library")
.libPaths("~/R/x86_64-pc-linux-gnu-library/2.11")
print(.libPaths())
print(sessionInfo())
print(version)
And the output before the error confirms that I am indeed running R 2.14.2 and my R packages folder is first in the search path. But I still get the error.

 So my question is how do I determine which version of the 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?

1 Answer

0 votes
by (25.4k points)

You can use the packageVersion() function to print version information about the loaded packages.

For example:

packageVersion('ggplot2')

Output:

[1] ‘3.2.0’

To print the version information about R, the OS and attached or loaded packages, use the sessionInfo() function.

sessionInfo()

Output:

Welcome to Intellipaat Community. Get your technical queries answered by top developers !

Categories

...