Create a temporary package and use roxygenise() to create and load documentation
path_document.RdInspired by document::document(), this package combines calls to
usethis::create_package() and roxygen2::roxygenise() to create a
temporary package based on a R script or directory of R scripts using roxygen
documentation. The scripts are loaded and the documentation is accessible
within RStudio using ?.
Usage
path_document(
path,
pkg = NULL,
fields = list(),
tmp_dir = tempdir(),
markdown = TRUE,
overwrite = FALSE,
roclets = NULL,
load_code = NULL,
clean = FALSE,
quiet = FALSE,
allow_file = TRUE,
regexp = "\\.[rR]$"
)
path_roxygenise(
path,
pkg = NULL,
fields = list(),
tmp_dir = tempdir(),
markdown = TRUE,
overwrite = FALSE,
roclets = NULL,
load_code = NULL,
clean = FALSE,
quiet = FALSE,
allow_file = TRUE,
regexp = "\\.[rR]$"
)Arguments
- path
A character vector of one or more paths.
- pkg
Package name. Optional.
- fields
A named list of fields to add to
DESCRIPTION, potentially overriding default values. Seeuse_description()for how you can set personalized defaults using package options.- tmp_dir
Directory where temporary package is created. Defaults to
tempdir().- markdown
If
TRUE(default), useusethis::use_roxygen_md()to ensure that Markdown formatted roxygen comments are converted.- overwrite
Default
FALSE. IfTRUE, overwrite the NAMESPACE file and any R scripts at the same location sharing the same names.- roclets
Character vector of roclet names to use with package. The default,
NULL, uses the roxygenrocletsoption, which defaults toc("collate", "namespace", "rd").- load_code
A function used to load all the R code in the package directory. The default,
NULL, uses the strategy defined by theloadroxygen option, which defaults toload_pkgload(). See load for more details.- clean
If
TRUE, roxygen will delete all files previously created by roxygen before running each roclet.- quiet
If
TRUE, suppress messages from usethis and cli calls. This function always suppresses package startup messages when the package is loaded byroxygen2::roxygenise().- allow_file
If
TRUE,path_document()allows both file and directory input paths. IfFALSE, function errors on file path inputs.- regexp
A regular expression (e.g.
[.]csv$) passed on togrep()to filter paths.