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 the repositories and update outdated packages on the fly.
update.packages(lib.loc = NULL, repos = getOption("repos"),
contriburl = contrib.url(repos, type),
method, instlib = NULL,
ask = TRUE, available = NULL,
oldPkgs = NULL, ...,
checkBuilt = FALSE, type = getOption("pkgType"))
available.packages(contriburl = contrib.url(getOption("repos")),
method, fields = NULL)
old.packages(lib.loc = NULL, repos = getOption("repos"),
contriburl = contrib.url(repos),
instPkgs = installed.packages(lib.loc = lib.loc),
method, available = NULL, checkBuilt = FALSE)
new.packages(lib.loc = NULL, repos = getOption("repos"),
contriburl = contrib.url(repos, type),
instPkgs = installed.packages(lib.loc = lib.loc),
method, available = NULL, ask = FALSE, ...,
type = getOption("pkgType"))
download.packages(pkgs, destdir, available = NULL,
repos = getOption("repos"),
contriburl = contrib.url(repos, type),
method, type = getOption("pkgType"), ...)
install.packages(pkgs, lib, repos = getOption("repos"),
contriburl = contrib.url(repos, type),
method, available = NULL, destdir = NULL,
dependencies = NA, type = getOption("pkgType"),
configure.args = getOption("configure.args"),
configure.vars = getOption("configure.vars"),
clean = FALSE, Ncpus = getOption("Ncpus"), ...)
contrib.url(repos, type = getOption("pkgType"))
lib.loc |
character vector describing the location of R
library trees to search through (and update packages therein), or
|
repos |
character vector, the base URL(s) of the repositories
to use, i.e., the URL of the CRAN master such as
|
contriburl |
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 |
method |
Download method, see |
pkgs |
character vector of the short names of packages/bundles whose
current versions should be downloaded from the repositories.
If |
destdir |
directory where downloaded packages are stored. |
available |
an object listing packages available at the repositories
as returned by |
lib |
character vector giving the library directories where to
install the packages. Recycled as needed. If missing, defaults to
|
ask |
logical indicating whether to ask user before packages
are actually downloaded and installed, or the character string
|
checkBuilt |
If |
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). Not used if Only supported if The default, |
configure.args |
(not Windows) a character vector or a named list.
If a character vector with no names is supplied, the elements are
concatenated into a single string (separated by a space) and used
as the value for the A named list can be used also to the same effect, and that
allows multi-element character strings for each package
which are concatenated to a single string to be used as the
value for |
configure.vars |
(not Windows) similar, for
|
oldPkgs |
if specified as non-NULL, |
instPkgs |
by default all installed packages,
|
... |
(for (for (for |
type |
character, indicating the type of package to download and
install.
Possible values are |
clean |
a logical value indicating whether to specify
to add the |
Ncpus |
The number of parallel processes to use for a parellel
install of source packages. Values geater than one are supported
only if GNU |
fields |
a character vector giving the fields to extract from
the |
All of these functions work with the names of a package or bundle (and
not the component packages of a bundle, except for
install.packages
if the repository provides the necessary
information).
available.packages
returns a matrix of details corresponding to
packages/bundles currently available at one or more repositories. The
current list of packages is downloaded over the internet (or copied
from a local mirror). It returns only packages whose version
requirements are met by the running version of R.
old.packages
compares the information from
available.packages
with that from instPkgs
(installed.packages
by default) and reports installed
packages/bundles that have newer versions on the repositories or, if
checkBuilt = TRUE
, that were built under an earlier minor
version of R (for example built under 2.0.x when running R 2.1.1).
new.packages
does the same comparison but reports uninstalled
packages/bundles that are available at the repositories. It will
give warnings about incompletely installed bundles (provided the
information is available) and bundles whose contents has changed.
If ask != FALSE
it asks which packages should be installed
in the first element of lib.loc
.
download.packages
takes a list of package/bundle 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:"
and
"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.)
The main function of the set is update.packages
. First a list
of all packages/bundles found in lib.loc
is created and
compared with those available at the repositories. If ask =
TRUE
(the default) packages/bundles 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 the repositories 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/bundles. It takes a vector of names and a destination
library, downloads the packages from the repositories 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.) If
lib
is omitted or is of length one and is not a (group)
writeable directory, the code offers to create a personal library tree
(the first element of Sys.getenv("R_LIBS_USER")
) and install
there.
If a repository is used (rather than local ‘.tar.gz’ files),
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
).
contrib.url
adds the appropriate type-specific path within a
repository to each URL in repos
.
For install.packages
, destdir
is the directory to which packages will be downloaded. If it is
NULL
(the default) a directory downloaded_packages
of
the session temporary directory will be used (and the files will be
deleted at the end of the session).
If repos
or contriburl
is a vector of length greater than
one, the newest version of the package compatible with this version of R
is fetched from the first repository on the list within which it is found.
For available.packages
, a matrix
with one row per package/bundle, row names the package names and
column names "Package"
, "Version"
, "Priority"
,
"Bundle"
, "Depends"
, "Imports"
, "Suggests"
"Contains"
and "Repository"
. Additional columns can
be specified using the fields
argument.
For old.packages
, NULL
or a matrix with one row per
package/bundle, row names the package names and column names
"Package"
, "LibPath"
, "Installed"
(the version),
"Built"
(the version built under), "ReposVer"
and
"Repository"
.
For new.packages
a character vector of package/bundle names,
after any have been installed.
For download.packages
, a two-column matrix of names and
destination file names, for those packages/bundles successfully
downloaded. If packages are not available or there is a problem with
the download, suitable warnings are given.
install.packages
and update.packages
have no return value.
Take care when using dependencies
with update.packages
,
for it is unclear where new dependencies should be installed. The
current implementation will only allow it if all the packages to be
updated are in a single library, when that library will be used.
You are advised to run update.packages
before
install.packages
to ensure that any installed dependencies have
their latest versions.
Some binary distributions of R have INSTALL
in a separate
bundle, e.g. an R-devel
RPM. install.packages
will
give an error if called on such a system.
installed.packages
, remove.packages
See download.file
for how to handle proxies and
other options to monitor file transfers.
INSTALL
, REMOVE
,
library
, .packages
, read.dcf
The ‘R Installation and Administration’ manual for how to set up a repository.
## Not run:
install.packages(
c("XML_0.99-5.tar.gz",
"../../Interfaces/Perl/RSPerl_0.8-0.tar.gz"),
repos = NULL,
configure.args = c(XML = '--with-xml-config=xml-config',
RSPerl = "--with-modules='IO Fcntl'"))
## End(Not run)