update.packages {utils} | R Documentation |
These functions can be used to automatically compare the version numbers of installed packages with the newest available version on CRAN and update outdated packages on the fly.
update.packages(lib.loc = NULL, CRAN = getOption("CRAN"), contriburl = contrib.url(CRAN), method, instlib = NULL, ask = TRUE, available = NULL, destdir = NULL, installWithVers = FALSE) CRAN.packages(CRAN = getOption("CRAN"), method, contriburl = contrib.url(CRAN)) old.packages(lib.loc = NULL, CRAN = getOption("CRAN"), contriburl = contrib.url(CRAN), method, available = NULL) download.packages(pkgs, destdir, available = NULL, CRAN = getOption("CRAN"), contriburl = contrib.url(CRAN), method) install.packages(pkgs, lib, CRAN = getOption("CRAN"), contriburl = contrib.url(CRAN), method, available = NULL, destdir = NULL, installWithVers = FALSE, dependencies = FALSE)
lib.loc |
character vector describing the location of R library trees to search through (and update packages therein). |
CRAN |
character, the base URL of the CRAN mirror to use, i.e.,
the URL of a CRAN root such as "http://cran.r-project.org"
(the default) or its Statlib mirror,
"http://lib.stat.cmu.edu/R/CRAN" .
|
contriburl |
URL of the contrib section of CRAN. Use this argument
only if your CRAN mirror is incomplete, e.g., because you burned
only the contrib section on a CD. Overrides argument CRAN . |
method |
Download method, see download.file . |
pkgs |
character vector of the short names of
packages whose current versions should be downloaded from
CRAN .
|
destdir |
directory where downloaded packages are stored. |
available |
list of packages available at CRAN as returned by
CRAN.packages . |
lib |
character vector giving the library directories where to install the packages. Recycled as needed. |
ask |
logical indicating to ask before packages are actually downloaded and installed. |
installWithVers |
If TRUE , will invoke the install the
package such that it can be referenced by package version |
instlib |
character string giving the library directory where to install the packages. |
dependencies |
logical indicating to also install uninstalled packages on which these packages depend/suggest/import (and so on recursively). |
CRAN.packages
returns a matrix of package details corresponding
to packages/bundles currently available in the contrib section of
CRAN, the comprehensive R archive network. The current list of
packages is downloaded over the internet (or copied from a local CRAN
mirror).
old.packages
compares the information from CRAN.packages
with that from installed.packages
and reports installed
packages/bundles that have newer versions on CRAN.
download.packages
takes a list of package/bundle names and a
destination directory, downloads the newest versions of the package
sources and saves them in destdir
. If the list of available
packages is not given as argument, it is also directly obtained from
CRAN. If CRAN is local, i.e., the URL starts with "file:"
,
then the packages are not downloaded but used directly.
The main function of the bundle is update.packages
. First a
list of all packages found in lib.loc
is created and compared
with the packages available on CRAN. Packages with a newer version
are reported and for each one the user can specify if it should be
updated.
If so, the package sources are downloaded from
CRAN and installed in the respective library path (or instlib
if specified) using the R INSTALL
mechanism.
install.packages
can be used to install new packages. It
takes a vector of package names and a destination library, downloads
the packages from CRAN and installs them. If the library
is omitted it defaults to the first directory in .libPaths()
, with
a warning if there is more than one.
An attempt is made to install the packages in an order that respects
their dependencies. This does assume that all the entries in
lib
are on the default library path for installs (set by
R_LIBS
).
For install.packages
and update.packages
, destdir
is the directory to which packages will be downloaded. If it is
NULL
(the default) a temporary directory is used, and the user
will be given the option of deleting the temporary files once the
packages are installed. (They will always be deleted at the end of
the R session.)
For CRAN.packages
, a matrix with one row per package/bundle,
row names the package names and column names "Package"
,
"Version"
, "Priority"
, "Bundle"
,
"Depends"
, "Imports"
, "Suggests"
and "Contains"
.
For old.packages
, NULL
or a matrix with one row per
package/bundle and column names "Package"
, "LibPath"
,
"Installed"
and "CRAN"
. (The last two columns are
version numbers.)
For download.packages
, a two-column matrix of names and
destination file names, for those packages/bundles successfully downloaded.
install.packages
and update.packages
have no return value.
See download.file
for how to handle proxies and
other options to monitor file transfers.
INSTALL
, REMOVE
,
library
, .packages
, read.dcf