Roger Bivand wrote
> On Thu, 17 Nov 2016, Roger Bivand wrote:
> 
>> On Thu, 17 Nov 2016, Helmut Kudrnovsky wrote:
>>
>>> >  My Windows 7, GRASS 7.0.4 shows identical .libPaths() values both
>>> inside
>>> >  and out with RGui. I don't know how the location of the personal
>>> library
>>> >  folder is recorded - is it in the registry? How might one know? It
>>> looks
>>> >  like:
>>> > 
>>> >  Sys.getenv("R_LIBS_USER") 
>>>
>>>  tested within a winGRASS7.0.5 session:
>>> 
>>> >  Sys.getenv("R_LIBS_USER")
>>>  [1] "C:\\Users\\test/R/win-library/3.3"
>>> >  .libPaths()
>>>  [1] "C:/Program Files/R/R-3.3.1/library"
>>>
>>>  R_LIBS_USER is listed there within the winGRASS session, but the path
>>>  itself
>>>  looks odd.
>>
>> Unfortunately, I couldn't reproduce this with stand-alone GRASS 7.0.5 or
>> 7.2, 
>> Windows 7 Pro, R 3.3.2. I see the same .libPaths() values inside and
>> outside. 
>> But see below - I found out how to reproduce the problem predictably.
>>
>> The reason was (of course) that I'd forgotten that I had set R_LIBS_USER
>> in 
>> Control Panel -> System and Security -> System -> Advanced system
>> settings -> 
>> Environment Variables. I'd done this as a response to the extra work
>> caused 
>> at each annual change of the default address as R's version was
>> incremented. 
>> See also:
>>
>> https://stat.ethz.ch/R-manual/R-devel/library/base/html/libPaths.html
>>
>> So a workaround might to use the R_LIBS_USER environment variable in that 
>> setting, checking that the directory exists. R uses it internally as 
>> generated, but doesn't export it. I don't know how this plays
>> cross-platform.
> 
> In a context with Windows 7 without setting the R_LIBS_USER environment 
> variable, R outside GRASS reports:
> 
>> Sys.getenv("HOME")
> [1] "C:\\Users\\rsb\\Documents"
>> .libPaths()
> [1] "C:/Users/rsb/Documents/R/win-library/3.3"
> [2] "C:/Program Files/R/R-3.3.2/library"
> 
> but inside GRASS %HOME% is re-defined, so:
> 
>> Sys.getenv("HOME")
> [1] "C:\\Users\\rsb"
>> .libPaths()
> [1] "c:/Program Files/R/R-3.3.2/library"
> 
> as R cannot construct: subdirectory ‘R/win-library/x.y’ of the home 
> directory, for R x.y.z, because "C:\\Users\\rsb/R/win-library/x.y" does 
> not exist, and that is where R is looking (here in GRASS):
> 
>> Sys.getenv("R_LIBS_USER")
> [1] "C:\\Users\\rsb/R/win-library/3.3"
> 
> (the different dirseps do not matter).
> 
> Does WinGRASS need to change the HOME environment variable? If it does, 
> users of R in GRASS need to set R_LIBS or R_LIBS_USER, easiest once via 
> Control Panel.

could you download the files from
https://trac.osgeo.org/grass/browser/grass/trunk/mswindows/external/rbatch,
copy these to an arbitrary folder e.g. C:\wd\testfolder, open a windows
console within this folder and type R in the console, then try your test
with  Sys.getenv("R_LIBS_USER") and  .libPaths()?

for me it works that the general and private library is found by R.

I'll have a look if /where winGRASS changes %HOME%




-----
best regards
Helmut
--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/GRASS-can-t-find-R-packages-from-personal-library-on-Windows-tp5295771p5296409.html
Sent from the Grass - Stats mailing list archive at Nabble.com.
_______________________________________________
grass-stats mailing list
grass-stats@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-stats

Reply via email to