Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use nested item in .Rd?

Tags:

r

rd

I can use \item to make a list in .Rd files.

\item{blah}{blah}

But it seems that I can not create a nested list by put \item within another \item as in

\item{blah}{
\item{blah1}{some}
\item{blah2}{thing}
}

Does anybody know a way to generate a nested list in R documentation? Thanks.

like image 676
user1424739 Avatar asked Jul 06 '15 03:07

user1424739


2 Answers

Here's an example (ignore the #' if you don't use roxygen):

#' \itemize{
#'   \item First level, itemize, first item
#'     \itemize{
#'       \item Second level, itemize, first item
#'       \item Second level, itemize, second item
#'         \enumerate{
#'           \item Third level, enumerate, first item
#'           \item Third level, enumerate, second item
#'         }
#'     }
#'   \item First level, itemize, second item
#' }

Which results in (I used it in a Description block):

enter image description here

like image 72
hrbrmstr Avatar answered Sep 21 '22 23:09

hrbrmstr


If you use roxygen to generate your documentation, this can be accomplished simply using rmarkdown. The below code produces the same output as displayed in hrbrmstr's answer.

#' * First level, itemize, first item
#'   * Second level, itemize, first item
#'   - Second level, itemize, second item (- and * are equivalent)
#'     1. Third level, enumerate, first item
#'     2. Third level, enumerate, second item
#' * First level, itemize, second item
like image 42
Martin Smith Avatar answered Sep 21 '22 23:09

Martin Smith