使用 roxygen2 在单个文档对象中记录多个数据集多个、象中、文档、数据

2023-09-06 04:52:09 作者:煙圈的寂寞

我正在寻找一个等效于 @describeIn 的工具,它允许我为多个 R 数据对象创建一个文档对象.

I'm looking for an equivalent of @describeIn that will allow me to create a single documentation object for multiple R data objects.

我曾希望是这样的:

#' Tree Distances
#' 
#' These datasets contain the distances between sets
#' of 10-tip, 11-tip and 12-tip trees.
#' 
#' @name treeDistances
#' @keywords datasets
"treeDistances10"
"treeDistances11"
"treeDistances12"

将生成一个适用于所有三个 treeDistances## 对象的手册页,类似于使用 @describeIn treeDistances 11-tip 树之间的距离描述另一个函数中的一个函数.

would produce a single manual page that would apply to all three treeDistances## objects, similar to describing one function within another using @describeIn treeDistances Distances between 11-tip trees.

我注意到添加 @aliases treeDistance11 treeDistance12 将文档页面与数据对象相关联,但没有引用使用"部分中的对象 - 但我相信有更合适的方法来做到这一点?

I notice that adding @aliases treeDistance11 treeDistance12 associates the documentation page with the data objects, but without referencing the objects in the Usage section – but I believe that there is a more appropriate way to do this?

推荐答案

使用@rdname:

#' Tree Distances
#' 
#' These datasets contain the distances between sets
#' of 10-tip, 11-tip and 12-tip trees.
#' @name treeDistances
#' @keywords datasets
"treeDistances10"

#' @rdname treeDistances
"treeDistances11"

#' @rdname treeDistances
"treeDistances12"