lib_validate: Validate the local library

View source: R/valid.R

lib_validateR Documentation

Validate the local library


Checking if installed packages have correct versions taking into account all DESCRIPTION files requirements. Moreover identifying which packages are newest releases. Optionally we could add life duration and CRAN check page status for each package.


  lib.loc = .libPaths(),
  fields = c("Depends", "Imports", "LinkingTo"),
  lifeduration = FALSE,
  checkred = list(scope = character(0), flavors = NULL),
  built = FALSE,
  repos = biocran_repos()



character vector. Default: .libPaths()


a character vector listing the types of dependencies, a subset of c("Depends", "Imports", "LinkingTo", "Suggests", "Enhances"). Character string "all" is shorthand for that vector, character string "most" for the same vector without "Enhances", character string "strong" (default) for the first three elements of that vector. Default: c("Depends", "Imports", "LinkingTo")


logical if to assess life duration for each package in the library. MEATCRAN CRANDB is used for libraries with less than 500 packages. The direct web page download from CRAN or local evaluation for newest packages otherwise. Default: FALSE


list with two named fields, scope and flavor. scope of R CRAN check pages statuses to consider, any of c("ERROR", "FAIL", "WARN", "NOTE"). flavor is a vector of CRAN machines to consider, which might be retrieved with pacs::cran_flavors()$Flavor. By default an empty scope field deactivated assessment for checkred column, and NULL flavor will results in checking all machines. Default list(scope = character(0), flavor = NULL)


logical if to add an R version under which each package was installed. Useful mainly for a local usage. Packages installed with a previous version of R could not work correctly with the new version of R. Default: FALSE


character vector base URLs of the repositories to use. By default checking CRAN and newest Bioconductor per R version. Default pacs::biocran_repos()


data.frame with 4/6/8/9/10 columns.


character a package name.


character expected by DESCRIPTION files minimal version. "" means not specified so the newest version.


character installed package version.


numeric -1/0/1 which comes from utils::compareVersion function. 0 means that we have the same version as required by DESCRIPTION files. -1 means we have too low version installed, this is an error. 1 means we have higher version.


character package was built under this R version


integer if the package was built under the current R version, then 1 (good) and for older R versions 0 (possibly bad). A package built under older R version or mix of packages built under different versions could bring possible failures.


logical (Internet needed) if the installed version is the newest one. For Bioconductor if is the newest one per R version.


logical (Internet needed) if the package is on CRAN, version is not taken into account here.


(Optional) (Internet needed) logical if the NEWEST package contains any specified statuses on CRAN check page. pacs::checked_packages is used to quickly retrieve all statuses at once.


(Optional) (Internet needed) integer number of days a package was released.


Version.expected.min column not count packages which are not a dependency for any package, so could not be find in DESCRIPTION files. When turn on the lifeduration options, calculations might be time consuming for libraries bigger than 500 packages. Results are cached for 30 minutes with memoise package. BioConductor packages are tested only in available scope, checkred is not assessed for them. The crandb R packages database is a part of METACRAN project, source: Csárdi G, Salmon M (2022). pkgsearch: Search and Query CRAN R Packages.,


## Not run: 
pacs::lib_validate(checkred = list(scope = c("ERROR", "FAIL", "WARN")))
pacs::lib_validate(checkred = list(
  scope = c("ERROR", "FAIL"),
  flavors = cran_flavors()$Flavor[1:2]
# activate lifeduration argument, could be time consuming for bigger libraries.
  lifeduration = TRUE,
  checkred = list(scope = c("ERROR", "FAIL"))
# only R CRAN repository
pacs::lib_validate(repos = "")

## End(Not run)

pacs documentation built on May 11, 2022, 1:09 a.m.