Learn R Programming

DataPackageR (version 0.16.2)

data_version: Get the DataVersion for a package

Description

Retrieves the DataVersion of a package if available

Usage

data_version(pkg, lib.loc = NULL)

Value

Object of class 'package_version' and 'numeric_version' specifying the DataVersion of the package

Arguments

pkg

character the package name

lib.loc

character path to library location.

See Also

Examples

Run this code
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))
   data_version(pname)
}

Run the code above in your browser using DataLab