R/assert-version.R
assert_version.Rd
Assert that the local machine is using a version that satisfies the minimum version specified.
assert_version_r(minimum = base::package_version("4.2.1"))
A package_version or character that specifies the version of the software being examined (ie, R, a package, or an ODBC driver).
An error if the minimum version is not met.
If the local machine is using an acceptable version, an invisible()
TRUE
is returned.
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.
# Check R
assert_version_r("3.1.0")
assert_version_r()
# Fails:
if (FALSE) { # \dontrun{
assert_version_r("99.1.0")
} # }
# Check packages
assert_version_package("base", "3.1.0")
assert_version_package("OuhscMunge", "0.1.0")
# Fails:
if (FALSE) { # \dontrun{
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")
} # }
# Check ODBC driver version
if (FALSE) { # \dontrun{
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)
} # }