Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inherit Roxygen2 documentation for multiple arguments in R package

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?

like image 852
Simon Jackson Avatar asked Sep 29 '16 05:09

Simon Jackson


People also ask

What is .RD file in R?

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.

How do you write ROxygen2?

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.

How do I get the document function in R?

Press ctrl+3 to show it.

How do you add Roxygen?

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 ).


1 Answers

In case anyone else stumbles across this, the answer is that you cannot do this.

This comes from the roxygen2 creator, Hadley Wickham.

like image 171
Simon Jackson Avatar answered Sep 18 '22 15:09

Simon Jackson