16.16 Do repeat yourself
- Self-contained documentation vs.
DRY(don’t repeat yourself) - Limit user frustration resulting from navigating multiple help files
- Two ways to handle:
@inheritParams: reuse parameter documentation- From source
@inheritParams function - From another package
@inheritParams package::function
- From source
#' @param a This is the first argument.
foo <- function(a) a + 10
#' @param b This is the second argument.
#' @inheritParams foo
bar <- function(a, b) {
foo(a) * 10
}
# Equivalent to
#' @param a This is the first argument.
#' @param b This is the second argument.
bar <- function(a, b) {
foo(a) * 10
}@describeInor@rdname: document multiple functions in one place- Use with caution. Can lead to confusing documentation.
- See the
foobarexample - See the
arithmeticexample