I'm writing an R package and want to inherit the documentation for two arguments (say x
and y
) from an old function (say old()
) to a new function, new()
. The twist is that these two arguments share the same argument description. That is, in old()
, function, they were documented in a single line and separated by commas like this:
#' @param x,y Two arguments with the same description
I used the following for new()
to inherit these arguments:
#' @inheritParams old
However, when I build the package, the documentation for new()
lists x
but not y
.
Is there a way to inherit multiple arguments like these?
R objects are documented in files written in “R documentation” (Rd) format, a simple markup language much of which closely resembles (La)TeX, which can be processed into a variety of formats, including LaTeX, HTML and plain text.
The Roxygen2 format Include a blank #' line and then write a longer description. (“Creates a plot of the crayon colors in …”). The line with @return contains a description of what the function returns.
Press ctrl+3 to show it.
Inserting a skeleton - Do this by placing your cursor anywhere in the function you want to document and click Code Tools -> Insert Roxygen Skeleton (default keyboard shortcut Ctrl+Shift+Alt+R ).
In case anyone else stumbles across this, the answer is that you cannot do this.
This comes from the roxygen2 creator, Hadley Wickham.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With