as_params {options} | R Documentation |
Produce @param
roxygen sections for options
Description
Generate parameter documentation based on option behaviors. Especially useful for ubiquitous function parameters that default to option values.
Usage
as_params(...)
Arguments
... |
Character values of options to use. If named arguments are provided, the option description provided as the value is mapped to a parameter of the argument's name. |
Value
A character vector of roxygen2
@param
tags
See Also
Other options_roxygen2:
as_roxygen_docs()
Examples
options::define_options(
"whether messages should be written softly, or in all-caps",
quiet = TRUE
)
#' Hello, World
#'
#' @eval options::as_params("softly" = "quiet")
#'
hello <- function(who, softly = opt("quiet")) {
say_what <- paste0("Hello, ", who, "!")
if (quiet) say_what else toupper(say_what)
}
[Package options version 0.2.0 Index]