I can do this easily with input parameters by having multiple lines of @param
by doing as such:
#' @param var1 This is for x
#' @param var2 This is for y
#' @param var3 This is for Z
But how do you do that for the elements of a list you are returning. I want to include the names of each element and a description about them. Chaining together @return
or @param
does not have the same behavior. What is the appropriate tag?
#' @return A list with the following elements:
#' @something element1 Contains x
#' @something element2 Contains y
#' @something element3 Contains z
The package samr
has the exact markdown formatting I'm looking for:
R objects are documented in files written in “R documentation” (Rd) format, a simple markup language much of which closely resembles (La)TeX, which can be processed into a variety of formats, including LaTeX, HTML and plain text.
roxygen2 allows you to write specially formatted R comments that generate R documentation files ( man/*. Rd ) and a NAMESPACE file. roxygen2 is used by over 8,000 CRAN packages. Install the latest version of roxygen2 with: install.packages("roxygen2")
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With