使用 Roxygen 记录 R.oo 类/方法
有人能给我指出一个使用 Roxygen 记录 R.oo 类/方法的好例子吗?在 R.oo 中,类/方法是通过调用 setConstructorS3() 和 setMethodS3() 创建的,因此本身没有记录函数。您是否只是创建标准 Roxygen 函数文档,但将其放在 NULL 语句之上?
Could someone point me to a good example of documenting R.oo classes/methods with Roxygen? In R.oo, classes/methods are created by calls to setConstructorS3() and setMethodS3(), so there is no function to document per-se. Do you simply create standard Roxygen function documentation, but place it on top of a NULL statement?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为,
@usage
。MyMethod.ClassName
函数中需要一个点-点-点参数。#' @export MyMethod.ClassName
而是#' @S3method MyMethod ClassName
?示例代码:
I think,
@usage
are needed.MyMethod.ClassName
function for S3 generic/method consistency.#' @export MyMethod.ClassName
but rather#' @S3method MyMethod ClassName
?An example code:
经过一番尝试后错误,这就是我想出的。该解决方案确保所有对象都正确导出,R CMD 构建/检查不会呕吐,没有冗余文档,并且示例将执行。请注意,如果将@export 替换为@method/@S3method,则该解决方案将不起作用。理论上这应该有效,但对我来说却不起作用。有人有更好的解决方案吗?
After some trial & error, here's what I came up with. This solution ensures that all objects are exported properly, that R CMD build/check does not puke, that there is no redundant documentation, and that examples will execute. Note that the solution won't work if @export is replaced with @method/@S3method. Theoretically that should work, but it didn't for me. Someone have a better solution?