Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

r

roxygen2

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:

enter image description here

like image 818
TomNash Avatar asked Jan 29 '16 21:01

TomNash


People also ask

What is .RD file in R?

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.

What is Roxygen?

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")


1 Answers

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

like image 118
Brandon Loudermilk Avatar answered Nov 03 '22 09:11

Brandon Loudermilk