Suppose I have a function closure in my package, for example
f = function(x) {
x = x
g = function(y) x <<- y
h = function() x
list(g = g, h = h)
}
l = f(5)
l$g(10)
l$h()
What is the correct (in the official CRAN sense) way of documenting this function? In particular,
- I would like to use
roxygen2 - I would like to provide documentation for the functions
gandh
One way would be to do something similar to
?familywhere you documentg()andh()in theValuesection of the.Rdfile. Then provide extended documentation aboutg()andh()in a bespoke\section{foo}, which you point to in theValuesection entries for the two functions.Whilst roxygen won’t be able to do this from the argument
@param, but you should be able to write this as an arbitrary roxygen section to add to the Rd file. TheValuesection can be written as standard roxygen markup, only the bespoke section would need to be entered literally.