download.packages2 {reposTools}R Documentation

A function to download packages from a reposTools repository


This function will download specified packages from a reposTools-style repository. Users can specify specific versions of the packages, download methods and type of packages.


download.packages2(pkgs, repEntry, destDir, versions, type, method = "auto")


pkgs A vector of package names to download
repEntry The repository to download from
destDir The directory to store the downloaded files in. If none is provided, will use the current directory
versions An optional vector describing version numbers to be used. If provided, must be equal in length to pkgs
type Type of file: e.g. 'Source' or 'Win32'
method Download method. See download.file for details.


This function can be used to download packages from a repository.

The user can specify as many packages as they would like (even none, see below) to download and the system will attempt to retrieve them all. The repository to be used is specified as the repEntry parameter. The repositories function is recommended for non-programatical usage to obtain a valid repEntry object.

The pkgs parameter specifies the set of packages to try to download. If none is provided, all packges from the repository will be downloaded.

The destDir parameter specifies where to store the downloaded files. Not specifying this will result in the files being placed in the current directory.

The versions parameter is optional, and can be used to specify version numbers of the packages to download. If this is provided, it must be provided for all packages and thus must be of the same length as the pkgs parameter. Leaving it blank will result in the highest version available of each package being downloaded.

By default, the system will attempt to download the appropriate type of package for the operating system - for instance a user on Windows will get a Win32 .zip binary package. If one would like to override this, it can be done with type, current available values are Source and Win32.

Lastly, the method parameter can be used to specify the download method. See download.file for explanations of these values.


A vector of the filenames downloaded


Jeff Gentry

See Also

install.packages2, update.packages2,repositories


   tmpLib <- tempfile()

   z <- getReposEntry("")
   download.packages2(c("annotate", "geneplotter"), z, destDir=tmpLib)

   ## A more 'real world' example
   if (interactive()) {
       ## Using the repositories function will allow you to select
       ## a repository out of the known possibilities.  The return
       ## value is a repEntry object which can be used for download.packages2
       z <- repositories()
       download.packages2("Biobase", z, destDir=tmpLib)


[Package reposTools version 1.8.0 Index]