These functions can be used to automatically compare the version numbers of installed packages with the newest available version on the repositories and update outdated packages on the fly.
download.packages(pkgs, destdir, available = NULL, repos = getOption("repos"), contriburl = contrib.url(repos, type), method, type = getOption("pkgType"), …)
character vector of the names of packages whose latest available versions should be downloaded from the repositories.
directory where downloaded packages are to be stored.
an object as returned by
listing packages available at the repositories, or
makes an internal call to
character vector, the base URL(s) of the repositories
to use, i.e., the URL of the CRAN master such as
"https://cran.r-project.org" or its Statlib mirror,
URL(s) of the contrib sections of the
repositories. Use this argument only if your repository mirror is
incomplete, e.g., because you burned only the
contrib section on a
CD. Overrides argument
Download method, see
character string, indicate which type of packages: see
install.packages and ‘Details’.
A two-column matrix of names and destination file names of those packages successfully downloaded. If packages are not available or there is a problem with the download, suitable warnings are given.
download.packages takes a list of package names and a
destination directory, downloads the newest versions and saves them in
destdir. If the list of available packages is not given as
argument, it is obtained from repositories. If a repository is local,
i.e.the URL starts with
"file:", then the packages are not
downloaded but used directly. Both
"file:///" are allowed as prefixes to a file path. Use the
latter only for URLs: see
url for their interpretation.
(Other forms of file:// URLs are not supported.)
type = "both" looks at source
The main use is by
download.file for how to handle proxies and
other options to monitor file transfers.
The ‘R Installation and Administration’ manual for how to set up a repository.