Closed hadley closed 5 years ago
How about:
@quotedParams name1, name2, ...
@quotedParam name optional_unquoted_value
#' @quotedParams foo, bar
#' @quotedParam baz
#' @quotedParam qux A character vector of column names or an integer vector of column positions.
This would generate:
#' The following list of arguments are quoted. They all support
#' quasiquotation and unquoting of R code (symbols, expressions,
#' quosures). They should also support unquoting of actual values.
#' in which case the type of accepted values is indicated alongside
#' the parameter:
#'
#' * `foo`
#' * `bar`
#' * `baz`
#' * `qux`: A character vector of column names or an integer vector of column positions.
Why wouldn't that be documented with @param
?
Then we have to mention in @param
that the parameter is quoted and supports quasiquotation, which seems to be redundant with that section.
What if we inlined the bulleted list and automatically added "[quoted, see below]"
to the parameter text.
#' This function uses the [tidy evaluation](...) framework for NSE.
#' Arguments `foo`, `bar`, `baz`, and `quz` are quoted. They support
#' quasiquotation and unquoting of R code (symbols, expressions,
#' quosures). They should also support unquoting of actual values.
#' in which case the type of accepted values is indicated alongside
#' the parameter. See <...> for details
That would be a nice solution.
#' @section Tidy evaluation:
#'
#' This function uses the [tidy evaluation](...) framework for NSE.
#' Arguments `foo`, `bar`, `baz`, and `quz` are quoted. This means
#' that support quasiquotation, allowing you to unquote R code (symbols,
#' expressions, quosures) using `!!` and `!!!`.
#'
#' Learn more at <...>.
Feels like this really needs to be wrapped up in some general system for type/effect annotations so that we don't special case tidyverse conventions inside roxygen2.
Also, since this thread was last active, we got usethis::use_tidy_eval()
, which addresses the problem from a different angle.
I think it should look something like:
which would generate:
cc @lionel- @jennybc