p_vers: Package Version and Number of Dependencies

View source: R/p_vers.R

p_versR Documentation

Package Version and Number of Dependencies

Description

The information displayed by p_vers depends on the availability of crandb and binarydb in .GlobalEnv.

If crandb is not loaded in .GlobalEnv, p_vers returns a data.frame with two columns: first column nsloaded (TRUE/FALSE) detects (with base::isNamespaceLoaded) if the package namespaces are loaded. Second column version is the version number of the installed packages.

If crandb is loaded in .GlobalEnv, three columns are added. Column crandb displays the version number of the source packages recorded in the crandb file. Column gcc displays the nedd for a compilation. Column compare compares this version number with the version installed on the computer. Possible values are: -2 for a package not installed on the computer (NA) but available in crandb ; -1 for an installed package older than the source package available in CRAN ; 0 for an installed package with the same version number than CRAN ; +1 for a more recent package than the one available in CRAN ; +2 for a package installed on the computer and not available in CRAN (NA) ; +3 for a package not installed on the computer (NA) and not available in CRAN (NA).

If binarydb is loaded in .GlobalEnv, two or three columns are added. Column binary displays the version number of the binary packages recorded in the binarydb = available.packages, type = "binary") matrix. Column difvb compares the installed version on the computer with this binary version and column difbc compares (if crandb is in .GlobalEnv) the binary version with the source package available in CRAN (which can differ for recently updated packages, a matter of 1 to 3 days). The numbering is identical to the one used for crandb.

If ndeps = TRUE, two more columns are added with the number of recursive dependencies per package. Column tdeps includes the base and recommended packages. Column ndeps does not count them. This option can take some time. Set it to FALSE if you need speed.

p_vers_deps calculates the same information but includes the recursive dependencies. Subsetting by "compare < 0" returns a shorter data.frame with the uninstalled (-2) and the outdated (-1) packages. Packages marked with nsloaded = TRUE must be detached and unloaded before any reinstallation. Using this instruction before running install.packages or p_inst is very useful as it detects packages that are locked and cannot be reinstalled. The order provided by p_vers_deps is the best one for the reinstallation of outdated packages.

Usage

p_vers(..., char = NULL, ndeps = TRUE)

p_vers_deps(..., char = NULL, ndeps = TRUE, subset = "compare < 4",
  crandb = get("crandb", envir = .GlobalEnv))

Arguments

...

any format recognized by cnsc. A (list of) vector of packages for p_vers. A vector of packages for p_vers_deps

char

(name to) a character vector. Use this argument if ... fails or if you call the function from another function. If used, argument ... is ignored.

ndeps

logical. Calculate the number of recursive dependencies. crandb in .GlobalEnv is required for this option.

subset

character. Subset the output data.frame on som columns. The default "compare < 4" does not subset. Usual values are "compare < 0" or "compare < 0 && nsloaded == TRUE"

crandb

data.frame crandb. The data.frame of CRAN packages.

Examples

## In real life, download crandb from CRAN or load it from your directory
## with functions crandb_down() or crandb_load().
## In this example, we use a small file.
crandb_load(system.file("data", "zcrandb.rda", package = "RWsearch"))

## macOS and Windows users can launch (no file stored in RWsearch)
# binarydb_down()

pkgs <- cnsc(RWsearch, MASS, Matrix, NotAPkg, R)
p_vers(pkgs, ndeps = FALSE)
p_vers(p_deps(pkgs), ndeps = FALSE)

p_vers_deps(pkgs) # dependencies can be visualized with p_graphF(pkgs)


RWsearch documentation built on March 18, 2022, 5:17 p.m.