How to display the elements of a returned list in Roxygen?

Since the link was broken in the accepted answer, I included a simple example of roxygen documentation for a function that provides a list as a return value.

#' Sample function that returns a list and uses roxygen documentation.
#'
#'
#' @return A list with letters and numbers.
#' \itemize{
#'   \item A - The letters of the alphabet.
#'   \item B - A vector of numbers.
#' }
myfunction <- function() {
  list(
    A = LETTERS,
    B = 1:10
  )
}

Assuming your package is called mypackage, the above facilitates producing documentation similar to the output below when running ?mypackage::myfunction.

enter image description here

This was based on the link to R packages - Object Documentation - Text formatting reference sheet


From the documantation - http://r-pkgs.had.co.nz/man.html#text-formatting

@return Used to document the object returned by the function. For lists, use the \item{name a}{description a} describe each component of the list

Tags:

R

Roxygen2