Skip to contents

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.

Note

dataVersion() has been renamed to data_version()

See also

Examples

if(rmarkdown::pandoc_available()){
f <- tempdir()
f <- file.path(f,"foo.Rmd")
con <- file(f)
writeLines("```{r}\n tbl = table(sample(1:10,1000,replace=TRUE)) \n```\n",con=con)
close(con)
pname <- basename(tempfile())
datapackage_skeleton(name = pname,
   path=tempdir(),
   force = TRUE,
   r_object_names = "tbl",
   code_files = f)

   package_build(file.path(tempdir(),pname), install = FALSE)

   devtools::load_all(file.path(tempdir(),pname))
   data_version(pname)
}
#>  Creating '/tmp/Rtmp3b16FC/file6f8200c02c3/'
#>  Setting active project to '/tmp/Rtmp3b16FC/file6f8200c02c3'
#>  Creating 'R/'
#>  Writing 'DESCRIPTION'
#> Package: file6f8200c02c3
#> Title: What the Package Does (One Line, Title Case)
#> Version: 0.0.0.9000
#> Authors@R (parsed):
#>     * First Last <first.last@example.com> [aut, cre] (YOUR-ORCID-ID)
#> Description: What the package does (one paragraph).
#> License: `use_mit_license()`, `use_gpl3_license()` or friends to
#>     pick a license
#> Encoding: UTF-8
#> Roxygen: list(markdown = TRUE)
#> RoxygenNote: 7.3.1
#>  Writing 'NAMESPACE'
#>  Setting active project to '/tmp/Rtmp3b16FC/file6f83601c065'
#>  Setting active project to '/tmp/Rtmp3b16FC/file6f8200c02c3'
#>  Added DataVersion string to 'DESCRIPTION'
#>  Creating 'data-raw/'
#>  Creating 'data/'
#>  Creating 'inst/extdata/'
#>  Copied foo.Rmd into 'data-raw'
#>  configured 'datapackager.yml' file
#> 
#>  1 data set(s) created by foo.Rmd
#>  tbl
#>  Built  all datasets!
#> Non-interactive NEWS.md file update.
#> 
#>  Creating 'vignettes/'
#>  Creating 'inst/doc/'
#>  Loading file6f8200c02c3
#>  file6f8200c02c3.R:13: `@docType "package"` is deprecated.
#>  Please document "_PACKAGE" instead.
#> Writing NAMESPACE
#> Writing file6f8200c02c3.Rd
#> Writing tbl.Rd
#> ── R CMD build ─────────────────────────────────────────────────────────────────
#> * checking for file ‘/tmp/Rtmp3b16FC/file6f8200c02c3/DESCRIPTION’ ... OK
#> * preparing ‘file6f8200c02c3’:
#> * checking DESCRIPTION meta-information ... OK
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> * looking to see if a ‘data/datalist’ file should be added
#>   NB: this package now depends on R (>= 3.5.0)
#>   WARNING: Added dependency on R >= 3.5.0 because serialized objects in
#>   serialize/load version 3 cannot be read in older versions of R.
#>   File(s) containing such objects:
#>     ‘file6f8200c02c3/data/tbl.rda’
#> * building ‘file6f8200c02c3_1.0.tar.gz’
#> 
#> Next Steps 
#> 1. Update your package documentation. 
#>    - Edit the documentation.R file in the package source data-raw subdirectory and update the roxygen markup. 
#>    - Rebuild the package documentation with  document() . 
#> 2. Add your package to source control. 
#>    - Call  git init .  in the package source root directory. 
#>    -  git add  the package files. 
#>    -  git commit  your new package. 
#>    - Set up a github repository for your pacakge. 
#>    - Add the github repository as a remote of your local package repository. 
#>    -  git push  your local repository to gitub. 
#>  Loading file6f8200c02c3
#> [1] ‘0.1.0’