Install.packages: eliminating local repo usage

I just created a package ( RTIO ) and a package repository ( Q:/Integrated Planning/R ), which is the company's network drive.

I put my package in a folder:

Q:/Integrated Planning/R/bin/windows/contrib/2.15/RTIO_0.1-2.zip

Following the Dirk instructions in this SO, I ran the following commands:

 > setwd("Q:/Integrated Planning/R/bin/windows/contrib/2.15") > tools::write_PACKAGES(".", type="win.binary") > list.files() [1] "PACKAGES" "PACKAGES.gz" "RTIO_0.1-2.zip" > 

With the code below, I added the local repository to the list of repositories (and I will ask other users to do the same):

 options(repos = c(getOption("repos"), RioTintoIronOre = "Q:/Integrated Planning/R")) 

And now, trying to install my package, I get an error message:

 > install.packages("RTIO") 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 : unable to access index for repository Q:/Integrated Planning/R/bin/windows/contrib/2.15 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) 

What does unable to access index for repository tell me? And how can I fix this?

What I really want to do is under Windows, and with RStudio as an IDE, allow other internal R users to add this repo package in such a way that they are able to execute commands such as install.packages("RTIO") or update.packages() to get new versions of the package (and, presumably, will also be able to use the IDE to manage packages through the GUI).


UPDATE:

I'm one step closer thanks to agstudy's answer. Here is the result I get.

 > getOption("repos") CRAN CRANextra "http://cran.ms.unimelb.edu.au/" "http://www.stats.ox.ac.uk/pub/RWin" > setRepositories(addURLs=c(RioTintoIronOre = "file://Q:/Integrated Planning/R")) --- Please select repositories for use in this session --- 1: + CRAN 2: + CRAN (extras) 3: BioC software 4: BioC annotation 5: BioC experiment 6: BioC extra 7: Omegahat 8: R-Forge 9: rforge.net Enter one or more numbers separated by spaces, or an empty line to cancel 1: > getOption("repos") RioTintoIronOre "file://Q:/Integrated Planning/R" > 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 

Follow up questions:

  • Why am I prompted to select a repository when I use setRepositories() ?

  • When I hit 'enter' without entering a number and checking getOption("repos") it only shows File://Q:/Integrated Planning/R repository. Why is this?

  • When I do install.packges("RTIO") , it seems to find the file, but gives a warning cannot open compressed file and an error cannot open the connection . Pay attention to the output from list.files() above. Any idea why?

+6
source share
2 answers

You have a warning unable to access index for repository because install.packages trying to access your custom package in a remote repository (without local).

To fix this, you need to add your local repository to your repos R parameters. You need to add it as the path to the URL, not the path to the file. something like a file: //

Do something like this:

  setRepositories(addURLs=c(lRioTintoIronOre = "file://Q:/Integrated Planning/R")) 

To verify the correctness of all, the following should return TRUE:

  repos <- contrib.url(getOption('repos')) length(grep("^file:", repos)) > 0L 
+2
source

To avoid this message:

 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' 



Try removing // when specifying url in setRepositories

 > setwd("Q:/Integrated Planning/R/bin/windows/contrib/2.15") > tools::write_PACKAGES(".", type="win.binary") > setRepositories(addURLs=c(RioTintoIronOre = "file:Q:/Integrated Planning/R")) > install.packages("RTIO") 
+3
source

All Articles