【问题标题】:Roxygen: Defaulting help to another functionRoxygen:默认帮助另一个功能
【发布时间】:2018-01-06 21:37:38
【问题描述】:

我正在为一个函数编写帮助,我想要第二个函数来显示相同​​的帮助文件。如何在 Roxygen/devtools 中执行此操作?

例如,考虑以下情况:

我们首先有一个带有完整帮助文件的函数

#' Plot random points
#' @param color Color of random points
#' @export
plotRandomPoints = function(color = "red"){
   plot(NA, xlim = c(0, 10), ylim = c(-2,2))
   drawRandomPoints(col = color)
}

现在我们有了第二个函数,我们只想共享同一个帮助文件

#' <link to plotRandomPoints>
#' @export
drawRandomPoints = function(color = "red"){
  points(rnorm(10), col = color)
}

我们如何&lt;link to plotRandomPoints&gt;

【问题讨论】:

标签: r devtools roxygen2


【解决方案1】:

我相信@rdname 标签就是您要找的。如果你把第二个代码块改成这个

#' @rdname plotRandomPoints
#' @export
drawRandomPoints = function(color = "red"){
 points(rnorm(10), col = color)
}

生成的帮助文件应包含plotRandomPoints()drawRandomPoints()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-03-22
    • 1970-01-01
    • 1970-01-01
    • 2012-09-28
    • 2011-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多