Search code examples
roxygen2

How do I format roxygen2 return list similar to parameter list?


I've noticed that using \describe{} to create a list of returned objects does not have the same formatting as I see in documentation for packages I've downloaded from CRAN. How do I mimic their style? See the images below for the comparison. The code I used the generate the first is:

#' @return A list containing:\describe{
#'    \item{pars}{A numeric vector of parameter estimates}
#'    \item{std.errs}{A numeric vector of standard errors on parameters}
#'    \item{cov.mat}{Parameter covariance matrix (excluding mean)}
#' }

My cruddy documentationGorgeous fancy documentation


Solution

  • I figured it out. You need to use the tabular environment, code text formatting, and additional lines. The below code works.

    #' @return A list containing:\tabular{ll}{
    #'    \code{pars} \tab A numeric vector of parameter estimates \cr
    #'    \tab \cr
    #'    \code{std.errs} \tab A numeric vector of standard errors on parameters \cr
    #'    \tab \cr
    #'    \code{cov.mat} \tab Parameter covariance matrix (excluding mean) \cr
    #' }
    

    enter image description here