Last data update: 2014.03.03

R: Install specified version or relative version of a CRAN...
install_versionR Documentation

Install specified version or relative version of a CRAN package.

Description

If you are installing an package that contains compiled code, you will need to have an R development environment installed. You can check if you do by running has_devel.

Usage

install_version(package, version = NA, compare = NA,
  repos = getOption("repos"), type = getOption("pkgType"), ...)

Arguments

package

package name

version

If the specified version is NA or the same as the most recent version of the package, this function simply calls install. Otherwise, it looks at the list of archived source tarballs and tries to install an older version instead.

compare

If specified, and if the version is specified, enforces comparison of the package version. Valid values: ==, <, >, >=, or <=

...

Other arguments passed on to install.

repos

character vector, the base URL(s) of the repositories to use, e.g., the URL of a CRAN mirror such as "http://cran.us.r-project.org".

Can be NULL to install from local files (with extension ‘.tar.gz’ for source packages).

type

character, indicating the type of package to download and install.

Possible values are "source", "mac.binary.leopard" and "win.binary": the binary types can be listed and downloaded but not installed on other platforms.

The default is the appropriate binary type on Windows and on the CRAN binary OS X distribution, otherwise "source". For the platforms where binary packages are the default, an alternative is "both" which means ‘try binary if available, otherwise try source’. (This will only choose the binary package if its version number is no older than the source version. In interactive use it will ask before attempting to install source packages.)

Details

Note: This is an updated version of devtools 'install_version' It has been fixed to work with the latest CRAN repository and updated to support version comparisons (i.e. >, ==, <, etc.)

Value

whether the version was installed

Author(s)

Jeremy Stephens

Yoni Ben-Meshulam

Results