[R] Installing packages from folder on the computer

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Jun 22 20:25:42 CEST 2010

On 22.06.2010 19:30, Subramanian S wrote:
> i am able to install zip files of packages from local zip files using the
> file.choose() for the package argument in install.packages() function in R
> console and also from the Packages menu>install from local zip files. But
> if there are many packages to install (say>15 or 20), then i have to factor
> in dependencies of 15-20 packages which may be more than 100 or 200 packages
> in all to be installed. i'd have to go and choose so many of them.
> so, i want a command line solution.
> here is what i tried:
> following the CRAN Miror's hierarchy of the directory where package zip
> files are, i have put zip files of packages in:
> C:\R\packages\bin\windows\contrib\2.11
> To set this folder as my Mirror to install packages from, in Rprofile.site i
> replaced "http://my.local.cran"  with "file://C:/R/packages/" (full code
> given below) and then in R console i enter:
> install.packages(c("pkg1", "pkg2", ...),dependencies=TRUE)
> but dint succeed.
> Error message: Warning in gzfile(file, "r") :
>    cannot open compressed file
> '//C:/R/packages/bin/windows/contrib/2.11/PACKAGES', probable reason 'No
> such file or directory'

A CRAN style repository needs a PACKAGES file that is used by R to load 
the database of available packages within that repository.
Such a file can be created by function write_PACKAGES() in package tools.

Uwe Ligges

> Error in gzfile(file, "r") : cannot open the connection
> # code in Rprofile.site to set a CRAN mirror
>   local({r<- getOption("repos")
>        r["CRAN"]<- "http://my.local.cran/"
>         options(repos=r)})
> have changed this to:
>   local({r<- getOption("repos")
>        r["CRAN"]<- "file://C:/R/packages/"
>         options(repos=r)})
> Pls help.
> 	[[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.

More information about the R-help mailing list