[R] Where does R look for library packages - there is no package called 'BRugs'

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Feb 4 08:26:12 CET 2011


For the record, this is not a good answer to the question (and the 
real answer is 'explained fully' on the help page for .libPaths, and 
also in the rw-FAQ, Q4.2).

If you move your personal library directory, you need to set the 
environment variable R_LIBS_USER .

And personal (not site) environment variables should be set in 
~/.Renviron, not in Renviron.site.  If you want a site library, that 
is explained fully in the references in my first paragraph.

On Thu, 3 Feb 2011, conor1725 wrote:

>
>
> David Winsemius wrote:
>>
>>
>> On Jan 30, 2011, at 5:42 PM, conor1725 wrote:
>>
>>>
>>> I am have installed R on Windows 7 machine. R got installed in the
>>> directory
>>> C:\Program Files\R\R-2.12.0. Then I installed the package BRugs
>>> using the
>>> install.packages command. I did not get an option during the
>>> installation as
>>> to what directory I wanted BRugs installed in. It ended up in
>>> C:\myusername\Documents as C:\myusername\Documents\R\win-library
>>> \2.12\BRugs.
>>> When I open and R and run the command library(BRugs) it works fine.
>>>
>>> However, I would like to move the BRugs stuff out of my Documents
>>> folder,
>>> either to a subdirectory under Documents of my choosing or to
>>> somewhere in
>>> C:\Program Files\R\R-2.12.0. I tried just moving the whole folder and
>>> subfolders R\win-library\2.12\... from Documents to a subfolder. I
>>> don't
>>> think this matters, but just to complete, there is also a folder
>>> called Coda
>>> with the BRugs folder in the 2.12 folder and of course there are
>>> subfolders
>>> and files under each of the folders Coda and BRugs. Then when I try
>>> library(BRugs) I get the error message "Error in library(BRugs) :
>>> there is
>>> no package called 'BRugs'". So it seems R only knows to look for the
>>> BRugs
>>> package in it's original installation location.
>>>
>>> How can I get it to work having BRugs in one of my desired locations?
>>
>> Then you need to understand where R will be able to find your
>> packages, and how one might change that:
>>
>> ?libPaths
>>
>> --
>> David Winsemius, MD
>> West Hartford, CT
>>
>>
>
> I'm posting a specific answer to my own question for the record since The
> help for libPaths (actually should be ?.libPaths) doesn't explain this
> fully. I created the file Renviron.site in the folder C:\Program
> Files\R\R-2.12.0\etc and put the text R_LIBS =
> C:/Users/myusername/Documents/.../R/win-library/2.12 in that file.  The ...
> represents the path for the subdirectory that I moved R\win-library\2.12\...
> to.
> -- 
> View this message in context: http://r.789695.n4.nabble.com/Where-does-R-look-for-library-packages-there-is-no-package-called-BRugs-tp3247748p3259520.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list