2

I have the following problem (I am aware that there are many questions dealing with setting a new library path, such as Changing R default library path using .libPaths in Rprofile.site fails to work or Remove a library from .libPaths() permanently without Rprofile.site, and I have read all of them, but did not find an answer to my specific problem):

I want to avoid the dialogue box prompting me to set a personal library, because the library folder in Program Files tends to cause problems.

To do so, I set the environment variables R_LIBS and R_LIBS_USER in the Control Panel to "C:/Users/deca/Desktop/packages".

However, R still returns the Program Files library folder (both in R GUI and RStudio):

> print(.libPaths())
[1] "C:/Users/deca/Desktop/packages"    "C:/Program Files/R/R-3.4.3/library"

Even worse, when trying to install new packages, R keeps asking me to set a personal folder, which is exactly what I wanted to avoid by defining R_LIBS and R_LIBS_USER.

I also tried to only select the first path via .libPaths(.libPaths()[1]), but no matter what I try R keeps both paths.

I want to only have one single folder for my packages, C:/Users/deca/Desktop/packages. How can I do this?

deca
  • 730
  • 1
  • 8
  • 24
  • 1
    Maybe easiest would be if you'd install R somewhere under `C:/Users/deca/...` if that could solve your problem? Else if you want a single library path you'd somehow have to duplicate all the packages that come with base R (like stats, utils, methods etc - and base too?!) - and I have never tried whether that's even possible – RolandASc Feb 01 '18 at 10:16
  • @RolandASc I did that, and it works, thanks! I was just wondering if there is a way to keep the installation "as-is". – deca Feb 01 '18 at 11:36
  • I am having similar problem. In my case, I installed some package in my own R_LIBS_USER=/$HOME/myR, the environment variable is exported from my .bashrc file. And you can clearly see it (echo $R_LIBS_USEr display the correct directory). But when I launch R, the path is not pre-panded to the result of .libPaths() result. I don't know what got changed on my system (Centos), it used to work perfectly. Look all over the place did not see any one posted a solution. – Kemin Zhou Dec 29 '18 at 06:23

0 Answers0