0 votes
1 view
in R Programming by (5.3k points)

The way Roxygen seems to work is that the first line is the \title, everything else is in the \details, and then any @foo directives handle those things. But R documentation is richer than that. I can have "\section{Llamas}{Are they ungulates?}" in .Rd files.

But I can't get Roxygen to do anything other than wrapping it all in \details. Am I missing something?

I have a hacky solution, which is to stick an unmatched } before my \section. This then ends the \details section. I then have to not put an ending } in, because roxygen sticks one in thinking its closing the \details. Eeeeeurrrrrrrrgh.

1 Answer

0 votes
by (25.3k points)

In roxygen2, you just need to add the line @section Llamas: to the doc and thus anything after that will be in Llamas section until a new directive is encountered.

For example:

#' Llama llama llama


#' More about llamas


#' @section Llamas:

#' Are they ungulates?


#' @section Not llamas:

#' This section is not about llamas.  It is not very interesting.


#' @param notused A parameter that isn't used at all!

#' @export

llama <- function(notused){



The above code will give the following .Rd file:



\title{Llama llama llama}





  \item{notused}{A parameter that isn't used at all!}



  More about llamas



  Are they ungulates?


\section{Not llamas}{

  This section is not about llamas.  It is not very



Welcome to Intellipaat Community. Get your technical queries answered by top developers !