enum_fn_param_defaults | R Documentation |
Convenience function combining fn_param_defaults()
, wrap_chr()
and cli::ansi_collapse()
.
enum_fn_param_defaults(
param,
fn = sys.function(sys.parent()),
env = parent.frame(),
wrap = "`",
sep2 = " or ",
last = sep2,
...
)
param |
Parameter name. A character scalar. |
fn |
A function or a function name (searched for in |
env |
Environment |
wrap |
Character sequence the default parameter values are to be wrapped in. A character vector or something coercible to. |
sep2 , last |
Passed on to |
... |
Further arguments passed on to |
This function can be very convenient to avoid duplication in roxygen2 documentation by leveraging inline R code evaluation as follows:
#' @param some_param Some parameter. One of #' `r pal::enum_fn_param_defaults(param = "some_param", fn = "some_fn")`. #' some_fn <- function(some_param = c("a", "b", "c")) { some_param <- rlang::arg_match(some_param) ... }
A character scalar.
Other package documentation functions:
fn_param_defaults()
,
roxy_blocks()
,
roxy_obj()
,
roxy_tag_value()
,
roxy_to_md_links()
pal::enum_fn_param_defaults(param = ".name_repair",
fn = tibble::as_tibble) |>
cat()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.