install.packages2 {reposTools}R Documentation

Functions to download, install and manipulate local packages

Description

These functions are designed to allow the user to install, update and download packages from R repositories, as well as remove packages from their local system.

Usage

install.packages2(pkgs, repEntry, lib, recurse = TRUE, type,
getNewest=TRUE, force=FALSE,syncLocal = TRUE, searchOptions = TRUE,
versForce = FALSE, getAllDeps=FALSE, method="auto")

download.packages2(pkgs, repEntry, destDir, recurse=TRUE, type,
getNewest=TRUE, searchOptions=TRUE,versForce=FALSE, force=FALSE, method="auto")

update.packages2(pkgs=NULL, repEntry, libs=.libPaths(), recurse=TRUE,
type, prevRepos=TRUE, force=FALSE, fileSelect=baseFileSelect,
syncLocal=TRUE,versForce=FALSE, searchOptions=TRUE, getNewest=TRUE,
install=TRUE, update=TRUE, getAllDeps=FALSE, method="auto")

remove.packages2(pkgs, lib, force=FALSE)

Arguments

repEntry A ReposEntry object specifying a particular repository
pkgs A character vector of package name(s) to act upon
lib A path to install (or remove from) the package. If this directory does not exist, it will be created (if possible)
destDir A path to download the package to
libs A set of library path(s) to search for packages to update
prevRepos Whether or not to update a package from the repository it was installed from
force Whether or not to ignore any dependencies
fileSelect Function to determine if a package needs updating or not
recurse Whether to search through subrepositories for desired packages
type The type of package to download/install/etc (e.g. Source, Win32, etc)
syncLocal Whether to call syncLocalLibList if no local liblist is present
searchOptions Whether to search repositories listed in options("repositories") as well as specified repositories. Default is FALSE which means that if one specifies a repository, *only* that repository is used. If set to TRUE, and a user specifies a repository, then any repositories set in the user's options will also be used.
versForce Whether or not to override R version checking on binary packages
getNewest Whether or not to just get the newest available version of a package, or to provide alternate means (currently a menu selection) of obtaining a package
install Whether or not to install the downloaded package
update Whether to seek to update the package or simply install the requested version
getAllDeps Will automatically download all dependencies if TRUE, otherwise will prompt the user
method Defaults to "auto", identical to the same parameter used for download.file

Details

When "sets of packages" is specified, the user can pass in a name of a package, a pkgInfo object, a vector of package names, or a list that contains either/or representing multiple packages.

For install.packages2, update.packages2, and remove.packages2, the system will by default check to insure that no dependencies from other packages are being broken. This can be overridden using force=TRUE.

Also for all packages, the type parameter's default depends on the user's OS. If the user is using a windows machine, the default type to download from a repository is Win32, otherwise it is Source.

install.packages2: User can specify a ReposEntry object, a set of packages, or both. If no package names are specified, it is assumed the user wants everything available in the repository denoted by the ReposEntry. Will install packages requested into the library directory specified. If recurse==TRUE, will also search through any of the repository's listed subrepositories to find packages. Likewise, if searchOptions==TRUE, will also look in the repositories listed by options("repositories") (So, if one specifies packages w/o a ReposEntry, it will only look here).

download.packages2: Operates very similarly to install.packages2, except that the syntax is slightly different ('destDir' instead of 'lib', and no 'syncLocal' option as it does not interact with any local library management). In all other respects, it acts like install.packages2 except for the obvious differnece in that it doesn't actually install the packages.

update.packages2: Used to update a user's packages. Much like the other two, can take (or not) a ReposEntry object and also can be told to utilize the "repositories" option. A set of packages can be specified, or alternatively all packages in the specified 'libs' parameter will be used. If prevRepos==TRUE, the system will attempt to ascertain where the package was actually installed from previously and will update from there instead.

remove.packages2: Will remove packages specified by 'pkgs' from the libPath noted by 'lib' and reflect this change in the local library listing.

The functions check* are helper functions that do most of the actual work. They are not generally intended to be called directly by the user.

Author(s)

Jeff Gentry

See Also

syncLocalLibList,ReposEntry,genRepos,pkgInfo

Examples

## set up a temporary directory for use with these examples
## this directory will be used with the this-is-escaped-code{
## parameter.  For normal usage, most users will be okay with using
## the defaults of this-is-escaped-codenormal-bracket69bracket-normal and not need to specify manually
tmpLib <- tempfile()
dir.create(tmpLib)

## install a package from the standard repositories (listed by
## the command this-is-escaped-codenormal-bracket70bracket-normal
install.packages2("hu6800",lib=tmpLib)
## and another one from CRAN
install.packages2("abind",lib=tmpLib)

[Package Contents]