data_version: Get the DataVersion for a package

View source: R/dataversion.R

data_versionR Documentation

Get the DataVersion for a package

Description

Retrieves the DataVersion of a package if available

Usage

data_version(pkg, lib.loc = NULL)

dataVersion(pkg, lib.loc = NULL)

Arguments

pkg

character the package name

lib.loc

character path to library location.

Value

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

Note

dataVersion() has been renamed to data_version()

See Also

packageVersion

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)

   devtools::load_all(file.path(tempdir(),pname))
   data_version(pname)
}

ropensci/DataPackageR documentation built on April 17, 2024, 11:43 a.m.