[R] libPaths displays truncated path?
David Winsemius
dwinsemius at comcast.net
Thu Nov 23 17:36:46 CET 2017
> On Nov 23, 2017, at 4:34 AM, Loris Bennett <loris.bennett at fu-berlin.de> wrote:
>
> Hi,
>
> TL;DR
> -----
>
> I define the path
>
> /cm/shared/apps/R/site-library/3.4.2
>
> and add it to libPath. Why does libPath then display it as
>
> /cm/shared/apps/R/site-library/3.4
Generally one only has a different library for each major version of R. Major versions are consider just the first two numbers in the dot-separated versions system. Apparently libPaths is "smart" enough to make an effort to adhere to that convention. It appears your definition of "major" differs from the usual convention.
--
David
>
> ?
>
> 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?
>
> Cheers,
>
> Loris
>
> --
> Dr. Loris Bennett (Mr.)
> ZEDAT, Freie Universität Berlin Email loris.bennett at fu-berlin.de
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius
Alameda, CA, USA
'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law
More information about the R-help
mailing list