简体   繁体   中英

R set up local package repository

I'm trying to set up a local repository on my local network, following these instructions : Creating a local R package repository .

And I'm getting the same problem as the one described in the "Update" paragraph of : install.packages errors: Troubleshooting local repo usage , (Even if the question is marked as solved, there is no available solution provided)

I've put my package into the folder:

"S:/outils/packages R/bin/windows/contrib/3.2"

As per Dirk's instructions in this SO, I've run the following commands:

setwd("S:/outils/packages R/bin/windows/contrib/3.2")
tools::write_PACKAGES(".", type="win.binary")
list.files()
[1] "BayesTree_0.3-1.3.zip" "Epi_2.0.zip"           "PACKAGES"              "PACKAGES.gz"   

I ran the following command in order to point to my new local repository. I copied and pasted this command from the repo paragraph of the options help page :

local({r <- getOption("repos"); r["CRAN"] <- 'file://S:/Outils/packages R'; options(repos = r)})

And when I try to install some packages I get an error :

install.packages("Epi")
Warning in install.packages :
  cannot open compressed file 'S:/Outils/packages R/src/contrib/PACKAGES', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection

I tried to put the "PACKAGES" and the "PACKAGES.gz" files into the S:/outils/packages R/bin/windows/contrib/folder or into S:/outils/packages R/ , without any success.

If you read to the bottom of Dirk's answer, you'll see he mentions the wonderful drat package. This takes care of the pain you're experiencing and creates the PACKAGES.gz file and associated paths pain free.

As a bonus, drat ties in with github.io free of charge.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM