assert_data_version | R Documentation |
Assert that a data version in a data package matches an expectation.
assert_data_version(
data_package_name = NULL,
version_string = NULL,
acceptable = "equal",
...
)
data_package_name |
|
version_string |
|
acceptable |
|
... |
additional arguments passed to data_version (such as lib.loc) |
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".
invisible logical
TRUE if success, otherwise stop on mismatch.
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")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.