updatePackages: Update packages, spot new dependencies, and install them

View source: R/updatePkgDepends.R

updatePackagesR Documentation

Update packages, spot new dependencies, and install them

Description

Addresses the problem that updates for previously installed R packages may insert new dependencies. R's update.packages does not trigger the installation of packages that are added as new requirements in existing packages.

Usage

updatePackages(
  ask = FALSE,
  checkBuilt = TRUE,
  dependencies = c("Depends", "Imports", "LinkingTo"),
  libnew = "/usr/share/R/library/",
  repos = options("repos"),
  ...
)

Arguments

ask

If TRUE, asks user to select packages to update

checkBuilt

If TRUE, packages built under earlier versions of R are to be considered 'old'

dependencies

A vector specifying which type of dependencies need to be taken into account. We default to c("Depends", "Imports", "LinkingTo").

libnew

The R library folder into which the new packages must be installed. Defaults to "/usr/share/R/library", which is where EL7 likes those things. To install packages in personal user directory, put libnew = NULL.

repos

A vector of repositories on which to search for packages. Same definition as in R's install.packages or install.packages.

...

additional arguments passed to update.packages and install.packages

Details

This function checks for existence of updates, ascertains whether those packages impose new requirements, and installs any new requirements. Then it conducts the update.

This function is valuable in system maintenance because sometimes existing packages adopt new requirements and the update.packages function does not notice. Another possible case would be that a user accidentally deletes some packages without realizing other packages depend on them.

If this is run as the root/administrator privileged, then base R packages may be updated, but if user is not root/administrator, there will be a warning that packages were not updated because permissions were lacking. For example

"Warning: package 'boot' in library '/usr/lib/R/library' will not be updated.

This warning does not interfere with rest of purpose of this function, since the new dependencies can be installed in a place where the user has privileges, either by specifying libnew as a full directory name or by setting it to NULL, which puts new packages in $R_LIBS_USER

Value

A vector of new packages being installed

Author(s)

Paul Johnson <pauljohn@ku.edu>

Examples

## Not run: 
myrepos <- c("http://rweb.crmda.ku.edu/cran",
             "http://www.bioconductor.org/packages/3.3/bioc")
updatePackages(repos = myrepos)
## libnew defaults to "/usr/share/R/library". Specify NULL
## so that new packages will go to user's directory
updatePackages(libnew = NULL)

## End(Not run)

kutils documentation built on Sept. 17, 2023, 5:06 p.m.