例如,假设我的包中有一个函数闭包
f = function(x) {
x = x
g = function(y) x <<- y
h = function() x
list(g = g, h = h)
}
l = f(5)
l$g(10)
l$h()
什么是正确的(在官方CRAN http://cran.r-project.org/sense) 记录这个函数的方式?尤其,
- 我想用
roxygen2
- 我想提供功能文档
g
and h
一种方法是做类似的事情?family
你在哪里记录g()
and h()
in the Value
的部分.Rd
文件。然后提供有关的扩展文档g()
and h()
以定制的方式\section{foo}
,您在Value
这两个函数的节条目。
\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}
}
}
虽然 roxygen 无法从论证中做到这一点@param
,但您应该能够将其编写为任意 roxygen 部分以添加到 Rd 文件中。这Value
部分可以编写为标准 roxygen 标记,只有定制部分需要按字面输入。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)