0
votes

I'm writing the help for one function, and I would like a second function to display the same help file. How do I do this in Roxygen/devtools?

For example, consider the following:

We first have a function with a full helpfile

#' Plot random points
#' @param color Color of random points
#' @export
plotRandomPoints = function(color = "red"){
   plot(NA, xlim = c(0, 10), ylim = c(-2,2))
   drawRandomPoints(col = color)
}

Now we have a second function we want to just share the same help file

#' <link to plotRandomPoints>
#' @export
drawRandomPoints = function(color = "red"){
  points(rnorm(10), col = color)
}

How do we <link to plotRandomPoints>?

1
@inherit source_function will inherit parameters, return, references, description, details, sections, and seealso from source_function().cran.r-project.org/web/packages/roxygen2/vignettes/rd.html - Cedric

1 Answers

0
votes

I believe the @rdname tag is what you're looking for. If you change the second code block to this

#' @rdname plotRandomPoints
#' @export
drawRandomPoints = function(color = "red"){
 points(rnorm(10), col = color)
}

the resulting help file should include both plotRandomPoints() and drawRandomPoints()