【发布时间】:2019-12-13 17:19:49
【问题描述】:
我知道可以使用 rOxygen 使用 @describeIn 或 @rdname 标签将多个函数分组到同一个文档下。这对于具有相似目的/语法的函数组来说很好。
但是,我正在编写一个包,其中一组函数几乎总是应作为工作流的一部分执行。为了让事情更简洁,我想用一个例子来说明这个工作流程,并为所有涉及的功能展示它。
我需要将这些函数保存在它们单独的文档页面中,因为它们每个都有非常不同的目的、参数并且需要一个非常广泛的文档。我不想通过将所有内容组合在一起来混淆读者。
这有可能吗?例如,我可以拥有一个包含示例代码的文件并将其包含在所有函数文档中吗?
以防万一,我在下面添加了一些虚拟代码。
#' function1
#'
#' This does stuff
#'
#' @param a,b a and b
#' @return c
#' @export
#' @examples
#' # step 1 : do this
#' C <- function1(a,b)
#'
#' # step 2 : do that
#' D <- function2(C, e, f)
#'
#' # step 3 : profit.
function1 <- function(a,b){
return(a+b)
}
#' function2
#'
#' This also does stuff
#'
#' @param C could be from function1
#' @param e,f e and f
#' @return d
#' @export
#' @examples
#' # step 1 : do this
#' C <- function1(a,b)
#'
#' # step 2 : do that
#' D <- function2(C, e, f)
#'
#' # step 3 : profit.
function2 <- function(C, e, f){
return(C+e+f)
}
【问题讨论】: