[R] Installing Packages from a Local Repository

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Dec 15 19:06:00 CET 2012


On 15/12/2012 17:36, Uwe Ligges wrote:
> You have to specify the repository as
>
> "file:Q:/Integrated Planning/R"
>
> (and I am not entirely sure if blanks are supported).

Actually, that's not right: see ?url.  All URI schemes start like 
file:// . For Windows the help says

      In this form the path is relative to the root of the filesystem,
      not a Windows concept.  The standard form on Windows is
      ‘file:///d:/R/repos’: for compatibility with earlier versions of R
      and Unix versions, any other form is parsed as R as ‘file://’ plus
      ‘path_to_file’.  Also, backslashes are accepted within the path
      even though RFC1738 does not allow them.

Spaces should work, since it is R which converts this to a filepath (in 
a real URI there are lots of restrictions and spaces need to be encoded 
if the restrictions are enforced).  But file:// URIs on Windows are a 
minefield.

>
> Best,
> Uwe Ligges
>
>
>
> On 13.12.2012 11:52, Tommy O'Dell wrote:
>> Hi everyone,
>>
>> I've followed the instructions from R-Admin Section 6.6 for creating a
>> local repository. I've modified my Rprofile.site file to add the local
>> repository to my repos, but I haven't been able to successfully
>> install my
>> package from the repo.
>>
>> Here's the code that I've run.
>>
>> ##################################
>> sessionInfo()
>> getOption("repos")
>> setwd("Q:/Integrated Planning/R")
>> list.files(path = ".", recursive = TRUE)
>> tools::write_PACKAGES("bin/windows/contrib/2.15", type = "win.binary")
>> list.files(path = ".", recursive = TRUE)
>>
>> install.packages("RTIO")
>> install.packages("RTIO", repos = "Q:/Integrated Planning/R")
>> install.packages("RTIO", repos = "Q:/Integrated Planning/R", type =
>> "win.binary")
>>
>> unlink(c("bin/windows/contrib/2.15/PACKAGES","bin/windows/contrib/2.15/PACKAGES.gz"))
>>
>> ############
>>
>>
>> And here it is with output included:
>> ###########
>>> sessionInfo()
>> R version 2.15.1 (2012-06-22)
>> Platform: i386-pc-mingw32/i386 (32-bit)
>>
>> locale:
>> [1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252
>>   LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
>> LC_TIME=English_Australia.1252
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> loaded via a namespace (and not attached):
>> [1] tools_2.15.1
>>> getOption("repos")
>>                                  CRAN
>> CRANextra
>>                             MyLocal
>>      "http://cran.ms.unimelb.edu.au/" "http://www.stats.
>> ox.ac.uk/pub/RWin"
>>     "file://Q:/Integrated Planning/R"
>>> setwd("Q:/Integrated Planning/R")
>>> list.files(path = ".", recursive = TRUE)
>> [1] "bin/windows/contrib/2.15/RTIO_0.1-2.zip"
>>> tools::write_PACKAGES("bin/windows/contrib/2.15", type = "win.binary")
>>> list.files(path = ".", recursive = TRUE)
>> [1] "bin/windows/contrib/2.15/PACKAGES"
>> "bin/windows/contrib/2.15/PACKAGES.gz"
>> "bin/windows/contrib/2.15/RTIO_0.1-2.zip"
>>>
>>> install.packages("RTIO")
>> Installing package(s) into ‘C:/Program Files/R/R-2.15.1/library’
>> (as ‘lib’ is unspecified)
>> Warning in install.packages :
>>    cannot open compressed file '//Q:/Integrated
>> Planning/R/bin/windows/contrib/2.15/PACKAGES', probable reason 'No such
>> file or directory'
>> Error in install.packages : cannot open the connection
>>> install.packages("RTIO", repos = "Q:/Integrated Planning/R")
>> Installing package(s) into ‘C:/Program Files/R/R-2.15.1/library’
>> (as ‘lib’ is unspecified)
>> Warning in install.packages :
>>    unable to access index for repository Q:/Integrated
>> Planning/R/bin/windows/contrib/2.15
>> Warning in install.packages :
>>    package ‘RTIO’ is not available (for R version 2.15.1)
>>> install.packages("RTIO", repos = "Q:/Integrated Planning/R", type =
>> "win.binary")
>> Installing package(s) into ‘C:/Program Files/R/R-2.15.1/library’
>> (as ‘lib’ is unspecified)
>> Warning in install.packages :
>>    unable to access index for repository Q:/Integrated
>> Planning/R/bin/windows/contrib/2.15
>> Warning in install.packages :
>>    package ‘RTIO’ is not available (for R version 2.15.1)
>>>
>>>
>> unlink(c("bin/windows/contrib/2.15/PACKAGES","bin/windows/contrib/2.15/PACKAGES.gz"))
>>
>>>
>> #######################################
>>
>> I'd really like to be able to use "install.packages("RTIO")" without
>> having
>> to specify the repo, as this will make it easy for our other less
>> experienced R users.
>>
>> Any ideas why I get "warning: cannot open compressed file" and "error:
>> cannot open the connection"? As far as I can tell, I've followed the
>> R-Admin 6.6 instructions exactly.
>>
>> If it matters, Q: is a mapped network drive.
>>
>>     [[alternative HTML version deleted]]
>>
>>
>>
>> ______________________________________________
>> 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.
>>
>
> ______________________________________________
> 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