问题
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