install.packages
Install Packages from CRAN-like Repositories

Description

Downloads and installs packages from CRAN-like repositories, complete URLs, or local files.

Usage

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", 1L), verbose = getOption("verbose"), 
    libs_only = FALSE, INSTALL_opts, quiet = FALSE, keep_outputs = FALSE, 
    ...) 

Arguments

pkgs a character vector to indicate the names of packages to download and install. If repos is not NULL, then pkgs should give the names of the packages, which are downloaded from the preferred package repository. If repos is NULL, then pkgs should contain either the names of files in the local file system containing package archives (either a zip file or a tar-gzip file containing package files), the complete URL where the package is located, or the names of directories containing the source code of a package (if type is "source").
lib a character string specifying the directory in which to install the packages. By default, it is the first element of .libPaths(). You must have write permission in this directory. (You must be able to create a subdirectory in the directory).
repos a character vector containing the base URL of the repositories. If 'NULL', install from local files. By default it is getOption("repos"), but if pkgs is a single character string whose ending corresponds to the value of the type argument (".tar.gz" corresponds to type="source" and ".zip" to "win.binary"), then the default value of repos is NULL. That is, if pkgs looks like a file containing a package, it is treated as a file containing a package, unless you specify otherwise.
contriburl the URL(s) of the contrib sections of the repositories.
method method for function available.packages.
available an object that is the result of "available.packages". If 'NULL', it calls available.packages.
destdir a character vector to indicate where the downloaded packages are stored. If NULL, the session temporary directory is used.
dependencies a logical value or a character vector. Controls which of the entries in the package DESCRIPTION file are used to generate a list of packages to download and install. See Details for more information.
type a character vector to indicate the type of package to download and install. The possible values are "both", "source", "mac.binary", "mac.binary.mavericks", "win.binary" and "win64.binary". "win64.binary" is deprecated: in R, the types "win.binary" and "win64.binary" are identical. (Windows binary packages contain object code for both 32-bit and 64-bit Windows).

Setting this argument to "both" specifies that the function should look for a binary package in the repository. If a binary package is found, and if it is as new as the source package, then the binary package is installed.

configure.args list object or character vector, contains arguments of package configure, the same as flag "--configure-args".
configure.vars list object or character vector,, used to set environment configure, the same as flag "--configure-vars".
clean the same as flag "--clean" for "R CMD INSTALL"
Ncpus when bigger than 1, the same as flag "--pkglock", used to command "make" for arguments "-k, -j ".
libs_only a logical value. matches the option "--libs-only" for "R CMD INSTALL", or for the Windows OS, specifies whether to install just the DLL(s) from the binary packages. The default is FALSE.
INSTALL_opts a list object. Contains the options for installing packages.
verbose a logical value. If TRUE, displays the messages of the system command regarding getting, installing, updating, and so on.
quiet a logical value. If TRUE, displays the warning message for the library path. Matches the messages for downloading and installing. The default is FALSE.
keep_outputs a logical value or a character string. Currently not supported.
... additional arguments to be passed to download.packages.

Details

In each package, the DESCRIPTION file can specify the names (and possibly the versions) of package dependencies.
DESCRIPTION file sections Description
"Depends", "Imports", and "LinkingTo" The essential dependencies. The package depends on the listed package(s) for its basic functionality.
"Suggests" The package depends on the package(s) to run any examples in its documentation.
"Enhances" The package is enhanced by the presence of the referred package(s).
The possible values for the dependencies arguments are
NA Installs the directly-requested packages (those packages that are listed in the essential-dependency lines ("Depends", "Imports", and "LinkingTo") and, recursively, installs the packages listed in the essential dependency lines of the essential packages.)
FALSE Installs only the directly-requested packages. (Ignores all dependency lines.)
TRUE Installs the directly-requested packages, the packages listed in the essential-dependency lines, the packages listed in the "Suggests" section, and the packages listed in the essential dependency lines of the essential packages (recursively).
a character vector Specifies a subset of c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances"). Downloads and installs the directly-requested packages and, recursively, all packages mentioned in those lines of their DESCRIPTION files. Specifying a character vector can result in a very long list of packages.
Note All acceptable values of the dependencies argument except TRUE are fully recursive. In the TRUE case, it includes the "Suggests" packages for the first level of recursion, but it does not include the the "Suggests" packages at subsequent levels.
You can call install.packages specifying one of the following: See the Examples section for more information.
The CRAN repository contains binary version of its packages for Windows.
Alternatively, you can install a source package using a version of R, and then load the package in Spotfire Enterprise Runtime for R.
To compile a source package, you must make sure that the PATH contains the location of any compilation utilities, or you might see warnings and error messages from make. (Use the lib.loc argument to library or set .libPaths to point to the library location where R installed the package.)
After version 3.2.0, type is "both" in Windows OS, when type is "both", contriburl or available can't be specified, repos can't be NULL. when type is "both", source package will be tried if binary package not available or not up to date for Windows OS or Mac OS, but "type = both" not suitable for the other system OS.
Value
returns invisible NULL.
See Also
.libPaths, download.packages, remove.packages, chooseCRANmirror, .packages, library
Examples
install.packages("zoo")
install.packages(c("boot","MASS"))

## Not run: # install local newtree package from zip file in working directory: install.packages("newtree_1.2.zip")

# install rpart package in mylib directory: install.packages("rpart", lib="mylib")

# Install an older version of the crossval package from CRAN in a # temporary library: tmpLib <- tempfile("lib") dir.create(tmpLib) URL <- "https://cran.rstudio.com/src/contrib/Archive/crossval/crossval_1.0.2.tar.gz" install.packages(URL, lib=tmpLib, repos=NULL) ## End(Not run)

Package utils version 6.1.4-13
Package Index