assert_version | R Documentation |
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"))
minimum |
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.
Will Beasley
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.