new_vignette: Add an 'rmarkdown' Template

Description Usage Arguments Value References See Also Examples

Description

Generates an rmarkdown style template ‘.Rmd’ file and adds knitr to VignetteBuilder & Suggests fields if not already included.

Usage

1
2
3
4
new_vignette(title = paste("Introduction to", basename(getwd())),
  file.name = paste0(gsub("\\s+", "_", tolower(title)), ".Rmd"),
  vign.path = "vignettes", add.builder = TRUE, desc.path = "DESCRIPTION",
  builder = "knitr")

Arguments

title

The title of the rmarkdown vignette document. Defaults to Introduction to x where x is the name of the package.

file.name

The name of the vignette file. Defaults to lower case, underscore (for space) .Rmd file that utilizes the title argument.

vign.path

The path to the vignettes directory (where the vignette will be placed).

add.builder

logical. If TRUE the builder argument will be added as the VignetteBuilder fied in the ‘DESCRIPTION’ file. Additionally, if builder = "knitr" this will be added to Suggests: field if not already a dependency.

desc.path

The path to the ‘DESCRIPTION’ file. Defaults to desc.path = "DESCRIPTION".

builder

The name of the VignetteBuilder in the ‘DESCRIPTION’ file. Defaults to builder = "knitr".

Value

Generates a ‘____.Rmd’ vignette file template.

References

http://rmarkdown.rstudio.com/package_vignette_format.html
http://r-pkgs.had.co.nz/vignettes.html

See Also

Other new functions: new_data, new_r_test, new_r, new_test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
pax("temp_dir", open = FALSE)
dir.create("temp_dir/vignettes")
## Note: If used in RStudio with the root directory set to the 
##       package the user does not need to supply `vign.path` or `desc.path`
new_vignette("intro", vign.path = "temp_dir/vignettes", 
    desc.path = "temp_dir/DESCRIPTION")
unlink("temp_dir", TRUE, TRUE)

## End(Not run)

trinker/pax documentation built on May 31, 2019, 9:42 p.m.