Setting R_LIBS & avoiding “Would you like to use a personal library instead?”

前端 未结 1 1909
悲哀的现实
悲哀的现实 2021-01-03 04:49

My personal library is set as R_LIBS=~/.R/lib in ~/.Renviron. This works perfectly well when I install packages from rstudio. When I try installing new packages from a plain

1条回答
  •  孤城傲影
    2021-01-03 05:02

    Yes, I always unset it on the systems I use, and I even try to keep it out of the Debian package I maintain. In Debian we use

    /usr/lib/R/library                   for core R packages shipping with R
    /usr/lib/R/site-library              for r-cran-* packages from the distro
    /usr/local/lib/R/site-library        for what the user installs from CRAN
    

    with the appropriate ordering:

    R> .libPaths()
    [1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"   \
        "/usr/lib/R/library"           
    R> 
    

    and I do that by commenting this out

    #R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/3.1'}
    #R_LIBS_USER=${R_LIBS_USER-'~/Library/R/3.1/library'}
    
    # edd Apr 2003  Allow local install in /usr/local, also add a directory for
    #               Debian packaged CRAN packages, and finally the default dir 
    # edd Jul 2007  Now use R_LIBS_SITE, not R_LIBS
    R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:\
                               /usr/lib/R/site-library:/usr/lib/R/library'}
    

    and I think I have to update my patch in the Debian packaging...

    0 讨论(0)
提交回复
热议问题