Re: [Rd] Windows 7 and .libPaths()

From: Rui Barradas <ruipbarradas_at_sapo.pt>
Date: Mon, 06 Aug 2012 14:00:41 +0100

Hello,

Thanks, part of the problem was solved when I corrected the typo. Now it recognizes one of the missing directories.

 > .libPaths()
[1] "C:/Program Files/R/win-library/2.15" "C:/Program Files/R/R-2.15.1/library"

That typo is in the original files, I haven't changed that part, just tested if R, Rgui and Rterm were reading Rprofile.site by changing the options("help_type") setting from "html" to "text" and back to "html". It all went well.
And yes, the directories C:/Program Files/R/win-library and C:/Program Files/R/win-library/2.15 do exist. So now I'll play with the Rprofile.site file a bit to see if the other directory can also be found at startup or by .libPaths(new).

Just played a bit. With .libPaths(new = a dir I want). It doesn't extend the path, it overrides the previous setting. So, since in Rprofile.site C:/Program Files/R/win-library comes before C:/Program Files/R/win-library/2.15, only the latter is in effect during the R session. This is documented behaviour, " If called with argument |new|, the library search path is set to the existing directories in |unique(c(new, .Library.site, .Library))| and this is returned." So I've tried with a vector with two elements,

new <- c("C:/Program Files/R/win-library", "C:/Program Files/R/win-library/2.15")
.libPaths(new = new)
.libPaths()

[1] "C:/Program Files/R/win-library"      "C:/Program 
Files/R/win-library/2.15"
[3] "C:/Program Files/R/R-2.15.1/library"

All well now, I just have to edit Rprofile.site.

Thanks a lot, your tip solved the problem.

Rui Barradas
Em 06-08-2012 13:12, Duncan Murdoch escreveu:
> On 12-08-06 6:09 AM, Rui Barradas wrote:
>> Hello,
>>
>> I'm having some trouble trying to set the .libPaths() on Windows 7,
>> R-2.15.0 and R-2.15.1. The environment variables R_LIBS and R_LIBS_USER
>> are set according to the help page for .libPaths() and the Rprofile.site
>> file has the default setting, as shown below. R-2.14.1 recognizes the
>> lib paths but not R-2.15. Is this a bug or am I doing something wrong?
>
> There's at least one typo below, but besides that, it's hard to tell.
> Do the directories you're trying to set exist? More inline.
>
>> (I've also tried with R-2.12.0 and R-2.13.0 and it works as documented
>> but I only show here the output for R-2.14.1, R-2.15.0 and R-2.15.1)
>>
>> First, the Windows settings.
>>
>> Microsoft Windows [Versão 6.1.7601]
>> Copyright (c) 2009 Microsoft Corporation. Todos os direitos reservados.
>>
>> C:\Users\Rui>echo %R_LIBS%
>> C:/PROGRA~1/R/win-library;
>
> I don't think the terminal semicolon is needed, though it shouldn't
> cause a problem.
>
>>
>> C:\Users\Rui>echo %R_LIBS_USER%
>> C:/PROGRA~1/R/win-library;C:/PROGRA~1/R/win-library/%v;
>
> Does C:/PROGRA~1/R/win-library exist? Does
> C:/PROGRA~1/R/win-library/2.5 exist? Does
> normalizePath("C:/PROGRA~1/R/win-library", winslash="/") give a
> directory that exists?
>
>>
>> Then, file Rprofile.site .
>>
>> # set libPath to win-library
>> .libPaths(new="C:PROGRA~1/R/win-library")
>> .libPaths(new=paste("C:PROGRA~1/R/win-library",
>> paste(R.version$major,as.integer(R.version$minor),sep='.'), sep="/"))
>
> These lines have the typo: it should be C:/PROGRA~1, not C:PROGRA~1.
>
>>
>> Finally, three R sessions.
>>
>> #--------- R-2.14.1
>>
>> > .libPaths()
>> [1] "C:/Program Files/R/win-library" "C:/Program
>> Files/R/win-library/2.14"
>> [3] "C:/Program Files/R/R-2.14.1/library"
>> >
>> > sessionInfo()
>> R version 2.14.1 (2011-12-22)
>> Platform: i386-pc-mingw32/i386 (32-bit)
>>
>> locale:
>> [1] LC_COLLATE=Portuguese_Portugal.1252
>> LC_CTYPE=Portuguese_Portugal.1252
>> [3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C
>> [5] LC_TIME=Portuguese_Portugal.1252
>>
>> attached base packages:
>> [1] stats graphics grDevices utils datasets methods base
>>
>> #--------- R-2.15.0
>>
>> > .libPaths()
>> [1] "C:/Program Files/R/R-2.15.0/library"
>> >
>> > sessionInfo()
>> R version 2.15.0 (2012-03-30)
>> Platform: i386-pc-mingw32/i386 (32-bit)
>>
>> locale:
>> [1] LC_COLLATE=Portuguese_Portugal.1252
>> LC_CTYPE=Portuguese_Portugal.1252
>> [3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C
>> [5] LC_TIME=Portuguese_Portugal.1252
>>
>> attached base packages:
>> [1] stats graphics grDevices utils datasets methods base
>>
>> #--------- R-2.15.1
>>
>> > .libPaths()
>> [1] "C:/Program Files/R/R-2.15.1/library"
>> >
>> > sessionInfo()
>> R version 2.15.1 (2012-06-22)
>> Platform: i386-pc-mingw32/i386 (32-bit)
>>
>> locale:
>> [1] LC_COLLATE=Portuguese_Portugal.1252
>> LC_CTYPE=Portuguese_Portugal.1252
>> [3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C
>> [5] LC_TIME=Portuguese_Portugal.1252
>>
>> attached base packages:
>> [1] stats graphics grDevices utils datasets methods base
>>
>> loaded via a namespace (and not attached):
>> [1] fortunes_1.5-0
>>
>>
>> Rui Barradas
>>
>> ______________________________________________
>> R-devel_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 06 Aug 2012 - 13:03:45 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 06 Aug 2012 - 13:50:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive