[R] install.packages for local zip files

Muhammad Subianto msubianto at gmail.com
Mon Jul 17 12:53:22 CEST 2006


On 7/16/06, Daniel Gatti <dmgatti at mindspring.com> wrote:
> O/S: Linux
> R version : 2.2.1
>
> The R server doesn't have http internet access.  And the sys admins will
> not install the R libraries that I requested.  So I have downloaded the
> packages that I want to intall and have moved them into my home
> directory on the server.  These are a series of *.tar.gz files.  I want
> to install the R libraries in my home directory, but I can't get it to
> work.  According to the install.packages documentation :
>
> install.packages(pkgs, lib, repos = getOption("repos"),  contriburl =
> contrib.url(repos, type), method, available = NULL, destdir = NULL,
> installWithVers = FALSE, dependencies = FALSE, type = getOption("pkgType"))
>
> repos: character vector, the base URL(s) of the repositories to use,
>        i.e., .... Can be 'NULL' to install from local '.tar.gz' files.
>
> contriburl: URL(s) of the contrib section of the repositories. ......
>        Can be 'NULL' to install from local '.tar.gz' files.
>
>
>  pkgs: character vector of the short names of packages/bundles whose
>           current versions should be downloaded from the repositories.
>           If 'repos = NULL', a character vector of file paths of
>           '.tar.gz' files.  These can be source archives or binary
>           package/bundle archive files (as created by 'R CMD build
>           --binary'). ......
>
>  lib: character vector giving the library directories where to install
> the packages.  Recycled as needed.
>
> So I have issued a command like this:
>
>  > install.packages(pkgs="~/Rdownloads/hgug4112a_1.12.0.tar.gz", lib =
> "~/Rlib", repos=NULL, contriburl=NULL)
>
> Warning in download.packages(pkgs, destdir = tmpd, available =
> available,  :
>          no package '~/Rdownloads/hgug4112a_1.12.0.tar.gz' at the
> repositories
>
> As far as I can tell, I've given it the full path to the zip file, the
> directory in which to install the library and I've set the repository
> path to 'NULL' to indicate that I'm installing from an already
> downloaded zip file.  But I'm missing something.  Any ideas?
>
> Thanks,
> Dan
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



Put your packages, for example, in directory "/dir/of/pkgs"
library(tools)
write_PACKAGES("/dir/of/pkgs")

and the package will be installed to "/dir/of/R/libs"

install.packages("NameOfPkgs",
                 lib="/dir/of/R/libs",
                 repos=NULL,
                 dependencies=TRUE,
                 contriburl="file:////dir/of/pkgs")

Best, Muhammad Subianto



More information about the R-help mailing list