Within roxygen tags, you use .Rd syntax to format text. This vignette shows you examples of the most important commands. The full details are described in R extensions.

Note that \ and % are special characters. To insert literals, escape with a backslash: \\, \%.

Character formatting

  • \emph{italics}

  • \strong{bold}

  • \code{r_function_call(with = "arguments")}, \code{NULL}, \code{TRUE}

  • \pkg{package_name}


Standard LaTeX (with no extensions):

  • \eqn{a + b}: inline eqution

  • \deqn{a + b}: display (block) equation


Tables are created with \tabular{}. It has two arguments:

  1. Column alignment, specified by letter for each column (l = left, r = right, c = centre.)

  2. Table contents, with columns separated by \tab and rows by \cr.

The following function turns an R data frame into the correct format, adding a row consisting of the (bolded) column names and prepending each row with #' for pasting directly into the documentation.