Use roxygen2 to document multiple datasets in a single documentation object

ぃ、小莉子 提交于 2021-02-17 03:00:55

问题


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

I had hoped that something like this:

#' 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"

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.

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?


回答1:


Use @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"



回答2:


Following antoine-sac's link to r-pkgs.had.co.nz/man.html#multiple-man, the correct format is:

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

#' @rdname treeDistances
"treeDistances10"
#' @rdname treeDistances
"treeDistances11"
#' @rdname treeDistances
"treeDistances12"


来源:https://stackoverflow.com/questions/57390342/use-roxygen2-to-document-multiple-datasets-in-a-single-documentation-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!