简体   繁体   中英

roxygen2 link whole function family

In the @seealso tag of the roxygen2 package one typically links to another function like this @seealso \code{\link{functionName}} . I would like to link from one function to a whole family of functions (created using the @family tag). So something like @seealso \code{\link{@family familyName}} . Crucially, the function I would like to link from is not part of the family. Is this somehow possible besides the workaround of linking each member of the family individually?

The most elegant solution I could come up with is using templates. In the directory man-roxygen/seealso/ , I would create something like familyName.R with the following contents:

#' @seealso Functions from the family: [`a()`], [`b()`], and [`c()`].

Then, to include this template in the documentation of a function that is not in the family, use:

#' Do R
#' 
#' This function does some R.
#' 
#' @template seealso/familyName
#' 
#' @export
d <- function() {}

This is unfortunately not the ideal solution, but to some degree it is easier to manage. At least, it is easier to add and remove the family functions within this one template file instead of having to look for all references inside the R/ directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM