Search code examples
rdatasetdocumentationdocumentation-generationroxygen2

Use roxygen2 to document multiple datasets in a single documentation object


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?


Solution

  • 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"