[R] libPaths displays truncated path?

Loris Bennett loris.bennett at fu-berlin.de
Thu Nov 23 13:34:01 CET 2017



  I define the path


  and add it to libPath.  Why does libPath then display it as



Long version

I run a cluster of diskless nodes for which the OS is loaded
directly into RAM and other software is provided by an NFS server.
However, in the case of R, we use the R version provided by the OS and
just install additional packages on the NFS server.

So that R can find these additional packages, I have the following in
the site-wide Rprofile

  v <- R.Version()
  base_path = "/cm/shared/apps/R/site-library/"
  major_minor_version = paste(v["major"],v["minor"],sep=".")
  cm_shared_lib_path = paste0(base_path,major_minor_version)
  full_cm_shared_lib_path <- c(file.path(chartr("\\", "/", R.home()), "site-library"), cm_shared_lib_path)
  .libPaths( c( .libPaths(), full_cm_shared_lib_path ) )

Thus, when I start R I get this:

  > full_cm_shared_lib_path
  [1] "/usr/lib64/R/site-library"           
  [2] "/cm/shared/apps/R/site-library/3.4.2"

but also this

   > .libPaths()
  [1] "/home/loris/R/x86_64-redhat-linux-gnu-library/3.4"
  [2] "/usr/lib64/R/library"                             
  [3] "/usr/share/R/library"                             
  [4] "/usr/lib64/R/site-library"                        
  [5] "/cm/shared/apps/R/site-library/3.4"       

However, in order to get R to find the packages, I have to add a
symbolic link, thus:

  [/cm/shared/apps/R/site-library] $ ls -l 3.4.2
  lrwxrwxrwx 1 root root 3 Nov 23 09:21 3.4.2 -> 3.4

So, my mistake was to think that "minor" would return "4", whereas it in
fact returns "4.2".  So I actually set the path to ".../3.4.2" and
that's where R looks for packages.

But why does libPaths display the the path I *thought* I had set, but in
fact looks at the path I *really did* set?



Dr. Loris Bennett (Mr.)
ZEDAT, Freie Universität Berlin         Email loris.bennett at fu-berlin.de

More information about the R-help mailing list