Skip to content

R_LIBS + .Rprofile: how to get a specific library in .libPaths()[1]

2 messages · Marius Hofert, Brian Ripley

#
Dear all,

I would like to use my own library for packages. It should go in /Library/Frameworks/R.framework.
I therefore created a directory /Library/Frameworks/R.framework/library and now I would like this to appear as .libPaths()[1] (as default directory used by install.packages()). I created an file ~/.Rprofile and put in:
R_LIBS="/Library/Frameworks/R.framework/library"

I first had it without quotation marks, but then R complains about the slash. So at least I know that R finds my .Rprofile file. With quotation marks, no error appears, but when I execute .libPaths()[1], I still get the default-R library:
"/Library/Frameworks/R.framework/Versions/2.13/Resources/library". 
How can I get my own library?

I read http://stat.ethz.ch/R-manual/R-patched/library/base/html/Startup.html and since neither ?R_HOME/etc/Rprofile.site? nor R_PROFILE_USER are specified, I thought I create the file .Rprofile. 
This is on Mac OS X 10.7.1 with R 2.13.

Cheers,

Marius
#
You are taking the contents of a .Renviron file and putting it in 
.Rprofile.

There is a whole section at the help page you quote about not 
confusing the two ....
On Mon, 10 Oct 2011, Marius Hofert wrote: