On 19/09/2012 6:30 AM, Kyran Graham wrote:> Hi,
> Sorry for posting a question that has been asked before but I couldn't
> quite find the right answer in previous help topics.
> I am trying to set my library path to a user-specified library
> ("C:/Users/K/Documents/Work/RLib"). I have used
> .libPaths("C:/Users/K/Documents/Work/RLib") but when I check the
> .libPaths(), both the user-specified and default libraries appear. It
> appears that R is still using the default pathway as well (I tried removing
> certain packages from the user library to see if they still work and they
> do). I have seen solutions involving setting R_LIB in the .REnviron to the
> user library but I am unsure as to how to do this; is this done in the R
> program itself or through other means?
> I am running 32-bit Windows 7, R version 2.15.1
> Again, sorry for the repeat question but setting directories is not my
> strong point.
Depending on the security settings on your computer, you might not be
able to do this, or might have to log in as administrator to do it. But
here are two ways to set R_LIBS:
1. Outside of R, go into Control Panel | System | Advanced system
settings | Environment variables.
2. Under "User variables for <you>", click on New. Set Variable
name to
R_LIBS. Set variable value to "C:/Users/K/Documents/Work/RLib/".
(Leave off the quotes. They probably won't hurt, but I haven't tested
that...)
3. Click OK enough time to save the changes.
The second way is to find where R is installed and edit Renviron.site:
1. Run R.home() within R, to find where R is installed.
2. Outside of R, go to the "etc" subdirectory of the home directory.
Create the Renviron.site file there using Notepad (or edit the existing
one). To get it to save the file without a .txt instruction, you'll
need to put the name in quotes when you do Save As.
3. In that file, put the line
R_LIBS=C:/Users/K/Documents/Work/RLib/
This should work the next time you start R.
Duncan Murdoch