rbartpackages.base.require_r_package

rbartpackages.base.require_r_package(library, min_version)[source]

Load an R package’s namespace, requiring a minimum version.

The wrappers track the current release of each R package; a wrapper module calls this at import time to declare the oldest version it supports, so that an older installation fails immediately with a legible message instead of at some arbitrary later point.

Parameters:
  • library (str) – The name of the R package.

  • min_version (str) – The oldest supported version, written as R does (e.g. '0.9-34'). The comparison is R’s own, which reads - and . alike as component separators.

Raises:
  • ValueError – If library is not a valid R identifier, or min_version is not a valid R version.

  • ImportError – If the installed library is older than min_version.

Examples

Return type:

None

>>> require_r_package('dbarts', '0.9-34')