updatePackages {miniCRAN}R Documentation

Check for available package updates in a miniCRAN repo.

Description

oldPackages() indicates packages which have a (suitable) later version on the repositories whereas updatePackages() offers to download and install such packages.

Usage

oldPackages(path = NULL, repos = getOption("repos"),
  availPkgs = pkgAvail(repos = repos, type = type, Rversion = Rversion),
  method, availableLocal = pkgAvail(repos = path, type = type, Rversion =
  Rversion, quiet = quiet), type = "source", Rversion = R.version,
  quiet = FALSE)

updatePackages(path = NULL, repos = getOption("repos"), method,
  ask = TRUE, availPkgs = pkgAvail(repos = repos, type = type, Rversion =
  Rversion), oldPkgs = NULL, type = "source", Rversion = R.version,
  quiet = FALSE)

Arguments

path

Destination download path. This path is the root folder of your new repository.

repos

URL(s) of the 'contrib' sections of the repositories, e.g. "http://cran.us.r-project.org". Passed to available.packages()

availPkgs

Vector of available packages. Defaults to reading this list from CRAN, using available.packages()

method

Download method, see download.file().

availableLocal

all packages hosted in the miniCRAN repo, as returned by pkgAvail(). A subset can be specified; currently this must be in the same (character matrix) format as returned by pkgAvail().

type

Possible values are (currently) "source", "mac.binary" and "win.binary": the binary types can be listed and downloaded but not installed on other platforms. Passed to download.packages().

Rversion

List with two named elements: major and minor. If not supplied, defaults to system version of R, using R.version. Only used if type is not "source"

quiet

If TRUE, suppress status messages (if any), and the progress bar during download.

ask

logical indicating whether to ask user before packages are actually downloaded and installed, or the character string "graphics"``, which brings up a widget to allow the user to (de-)select from the list of packages which could be updated or added. The latter value only works on systems with a GUI version of [select.list()], and is otherwise equivalent toask = TRUE'.

oldPkgs

if specified as non-NULL, updatePackages() only considers these packages for updating. This may be a character vector of package names or a matrix as returned by oldPackages().

Details

These functions are based on update.packages(). However, rather than looking for locally installed packages they look for the package source and binaries in the miniCRAN repository.

Value

oldPackages() returns a matrix with one row per package and columns for "Package", "LocalVer", "ReposVer" and "Repository". The matrix row names the package names.

updatePackages returns NULL invisibly.

See Also

updatePackages(), pkgAvail().

Other update repo functions: addOldPackage, addPackage, checkVersions, makeRepo

Examples

### `oldPackages` and `updatePackages` require an existing miniCRAN repo

# Specify list of packages to download
revolution <- c(CRAN = getOption("minicran.mran"))
pkgs <- c("foreach")

pdb <- cranJuly2014

## Not run: 
  pdb <- pkgAvail(repos = revolution, type = "source")

## End(Not run)

pkgList <- pkgDep(pkgs, availPkgs = pdb, repos = revolution, type = "source", suggests = FALSE)
pkgList

## Not run: 
  # Create temporary folder for miniCRAN
  dir.create(pth <- file.path(tempdir(), "miniCRAN"))

  # create the miniCRAN directory structure but only add bin files
  makeRepo(pkgList, path = pth, repos = revolution, type = "source", download = FALSE)
  makeRepo(pkgList, path = pth, repos = revolution, type = "win.binary", download = TRUE)

  # download old source package version and create repo index
  oldVers <- data.frame(package = c("foreach", "codetools", "iterators"),
                        version = c("1.4.0", "0.2-7", "1.0.5"),
                        stringsAsFactors = FALSE)
  addOldPackage(pkgList, path = pth, repos = revolution, vers = oldVers$version, type = "source")
  # NOTE: older binary versions would need to be build from source

  # Check if updated packages are available
  oldPackages(path = pth, repos = revolution, type = "source") # should need update
  oldPackages(path = pth, repos = revolution, type = "win.binary") # should be current

  # Update available packages
  updatePackages(path = pth, repos = revolution, type = "source", ask = FALSE) # should need update
  updatePackages(path = pth, repos = revolution, type = "win.binary") # should be current

  # Delete temporary folder
  unlink(pth, recursive = TRUE)

## End(Not run)

[Package miniCRAN version 0.2.10 Index]