document: Build documentation for a data package using DataPackageR.

Description Usage Arguments Examples

View source: R/processData.R

Description

Build documentation for a data package using DataPackageR.

Usage

1
document(path = ".", install = TRUE, ...)

Arguments

path

character the path to the data package source root.

install

logical install and reload the package. (default TRUE)

...

additional arguments to install

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# A simple Rmd file that creates one data object
# named "tbl".
if(rmarkdown::pandoc_available()){
f <- tempdir()
f <- file.path(f,"foo.Rmd")
con <- file(f)
writeLines("```{r}\n tbl = table(sample(1:10,100,replace=TRUE)) \n```\n",con=con)
close(con)

# construct a data package skeleton named "MyDataPackage" and pass
# in the Rmd file name with full path, and the name of the object(s) it
# creates.

pname <- basename(tempfile())
datapackage_skeleton(name=pname,
   path=tempdir(),
   force = TRUE,
   r_object_names = "tbl",
   code_files = f)

# call package_build to run the "foo.Rmd" processing and
# build a data package.
package_build(file.path(tempdir(), pname), install = FALSE)
document(path = file.path(tempdir(), pname), install=FALSE)
}

DataPackageR documentation built on March 17, 2021, 5:07 p.m.