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

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Feb 5 18:01:29 CET 2011



On 05.02.2011 00:32, conor1725 wrote:
>
> I created a file called .Renviron and set R_LIBS_USER to the same path I had
> set R_LIBS to. I put this file in
> C:/Users/myusername/Documents/mysubdirectory. I also commented out the line
> I had put in the Renviron.site file. Now I get the same error as I
> originally got. When I put .Renvrion in C:/Users/myusername/Documents
> instead, it does work, but the original reason I posted my question was my
> desire to not have anything R (or BRugs) related directly in my
> C:/Users/myusername/Documents folder. If there's a way to do this the
> correct way without putting any files or folders in my
> C:/Users/myusername/Documents folder as opposed to my
> C:/Users/myusername/Documents/mysubdirectory folder or my C:/Program
> Files/R/R-2.12.0, I'd still be interested in knowing how.


Then just define an environment variable in your OS settings.

Uwe Ligges



>
> Prof Brian Ripley wrote:
>>
>> 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
>>
>> ______________________________________________
>> 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.
>>
>>
>



More information about the R-help mailing list