Documenting function closures

雨燕双飞 提交于 2019-12-03 12:08:17

One way would be to do something similar to ?family where you document g() and h() in the Value section of the .Rd file. Then provide extended documentation about g() and h() in a bespoke \section{foo}, which you point to in the Value section entries for the two functions.

\value{
  Returns an object of class \code{"foo"}, a list with the
  following components:

  \item{g}{function; does foo. See Returned Functions for details.}
  \item{h}{function; does bar. See Returned Functions for details.}
}
\section{Returned Functions}{
  The returned functions do, blah blah...

  \code{g} is defined as

  \preformatted{
  g(x, y, z, ...)
  }

  Arguments are:

  \describe{
    \item{x}{foo}
    \item{y}{foo}
    \item{z}{foo}
  }
}

Whilst roxygen won't be able to do this from the argument @param, but you should be able to write this as an arbitrary roxygen section to add to the Rd file. The Value section can be written as standard roxygen markup, only the bespoke section would need to be entered literally.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!