Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

roxygen2

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

like image 842
Ben Avatar asked Sep 20 '25 20:09

Ben


1 Answers

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

like image 57
Ben Avatar answered Sep 23 '25 11:09

Ben