assert_data_version {DataPackageR} | R Documentation |
Assert that a data version in a data package matches an expectation.
Description
Assert that a data version in a data package matches an expectation.
Usage
assert_data_version(
data_package_name = NULL,
version_string = NULL,
acceptable = "equal",
...
)
Arguments
data_package_name |
|
version_string |
|
acceptable |
|
... |
additional arguments passed to data_version (such as lib.loc) |
Details
Tests the DataVersion string in data_package_name
against version_string
testing the major, minor and revision portion.
Tests "data_package_name version equal version_string" or "data_package_name version equal_or_greater version_string".
Value
invisible logical
TRUE if success, otherwise stop on mismatch.
Examples
if(rmarkdown::pandoc_available()){
f <- tempdir()
f <- file.path(f, "foo.Rmd")
con <- file(f)
writeLines("```{r}\n vec = 1:10 \n```\n",con = con)
close(con)
pname <- basename(tempfile())
datapackage_skeleton(name = pname,
path=tempdir(),
force = TRUE,
r_object_names = "vec",
code_files = f)
package_build(file.path(tempdir(),pname), install = FALSE)
pkgload::load_all(file.path(tempdir(),pname))
assert_data_version(data_package_name = pname,version_string = "0.1.0",acceptable = "equal")
}
[Package DataPackageR version 0.16.0 Index]