Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When documenting in Roxygen: How do I make an itemized list in @details?

What is the appropriate syntax to add an itemized list to roxygen2, for instance, in the @details section? Can I create a latex list environment?

It seems that line breaks are simply ignored, i.e.

#' @details text describing parameter inputs in more detail
#'
#' parameter 1: stuff
#' 
#' parameter 2: stuff

thanks!

like image 481
cboettig Avatar asked Feb 13 '12 20:02

cboettig


People also ask

How do I write R package documents?

To add documentation to an R package, you need to create a subdirectory “ man ” containing a set of files, one per function, in a special R Documentation format ( . Rd ). These will be the source for the documentation for each function; R processes them to create plain text, PDF, and HTML versions.

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.

How do you add Roxygen?

Inserting a skeleton - Do this by placing your cursor anywhere in the function you want to document and click Code Tools -> Insert Roxygen Skeleton (default keyboard shortcut Ctrl+Shift+Alt+R ).


2 Answers

Here is a roxygen2 example following your problem formulation.

##'
##' @details text describing parameter inputs in more detail.
##' \itemize{
##'  \item{"parameter 1"}{Stuff}
##'  \item{"parameter 2"}{Stuff}
##' }
##'

This will allow you to use itemize in details section. You can also use it in the @param sections.

Hope this helps.

like image 112
Dr. Mike Avatar answered Oct 24 '22 08:10

Dr. Mike


Since roxygen2 6.0.0 you can use markdown directly in your R documentation.

#' @details text describing parameter inputs in more detail.
#' * parameter 1 stuff
#' * parameter 2 stuff
#' @md

To use this either include Roxygen: list(markdown = TRUE) in your description to turn markdown on for the whole package or add the @md tag to a single file.

like image 25
needRhelp Avatar answered Oct 24 '22 08:10

needRhelp