assert_version: I that the local machine is using an acceptable version.

assert_versionR Documentation

I that the local machine is using an acceptable version.

Description

Assert that the local machine is using a version that satisfies the minimum version specified.

Usage

assert_version_r(minimum = base::package_version("4.2.1"))

Arguments

minimum

A package_version or character that specifies the version of the software being examined (ie, R, a package, or an ODBC driver).

Value

An error if the minimum version is not met. If the local machine is using an acceptable version, an invisible() TRUE is returned.

Note

These functions help us assert the the local machine has an acceptable version of the software running.

For assert_version_r(), the current default value is "4.2.0" because it introduced the placeholder for the native pipe. Future versions of OuhscMunge will likely increase the default value to keep pace with important developments to R.

Author(s)

Will Beasley

Examples

# Check R
assert_version_r("3.1.0")
assert_version_r()
# Fails:
## Not run: 
assert_version_r("99.1.0")

## End(Not run)

# Check packages
assert_version_package("base", "3.1.0")
assert_version_package("OuhscMunge", "0.1.0")
# Fails:
## Not run: 
assert_version_package("base", "99.1.0")
assert_version_package("OuhscMunge", "9.1.0")
assert_version_package(
  package_name      = "OuhscMunge",
  minimum           = "9.1.0",
  installation_code = 'remotes::install_github("OuhscBbmc/OuhscMunge")'
)
assert_version_package("OuhscMungeee", "9.1.0")

## End(Not run)

# Check ODBC driver version
## Not run: 
cnn <- DBI::dbConnect(odbc::odbc(), dsn = "dhs_waiver_eval_1")
assert_version_driver_sqlserver(cnn, "3.1.0")
# Fails: assert_version_driver_sqlserver(cnn, "99.1.0")
DBI::dbDisconnect(cnn)

## End(Not run)

OuhscBbmc/OuhscMunge documentation built on Dec. 5, 2024, 4:34 a.m.