16.3 Arguments

  • This is where most of the work will be
  • Use @param tag
  • succinct summary of the inputs and what parameter does
  • best practice to describe default argument values even if more work when they later change
  • list fixed set of possible parameter values
  • bulleted lists possible

16.3.1 Multiple Arguments

document tightly coupled arguments by separating names with commas

#' @param x,y A pair of character vectors.

16.3.2 Inheriting Arguments

@inheritParams: reuse parameter documentation

  - From source `@inheritParams function`
  - From another package `@inheritParams package::function`
  
#' @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
}