What's the best way to document an S4 method that takes arguments
beyond those in the signature?

setGeneric("sim", function(simP, dataP, ...) standardGeneric("sim"))

setMethod("sim", signature="SimParameters", function(simP, dataP) {
    lapply(seq(simP@NIter), function(i) do.one(simP, dataP, i))

For which promptClass generates
    \item{sim}{\code{signature(simP = "SimParameters")}: ... }

I turned that into
    \item{sim}{\code{signature(simP = "SimParameters", datap)}: ... }

which seems a little funny since the real signature only mentions one
argument. R CMD check does not complain about it, however. Since omitted
arguments are effectively class "ANY", one alternative is 
    \item{sim}{\code{signature(simP = "SimParameters", datap = "ANY")}: ... }

I also considered adding the non-signature arguments in the text.

Finally, although datap is formally untyped, there are requirements on
what kind of object it can be.  In practice it is only likely to be
from one of two classes, but I want to allow the users to make their own.

Thanks for your thoughts.

Ross Boylan

P.S. And what would I do if a particular method actually used an
argument in ..., e.g.,
setMethod("sim", signature="SimParameters", function(simP, dataP, bar,
How would one document the bar argument?

R-package-devel@r-project.org mailing list

Reply via email to