Tuesday, December 02, 2014

S4 methods with roxygen2


I thought that you need a .local() function internal to your S4 method in order to have non-standard arguments.

No, you just let the ... carry new ones.

For roxygen2 you need @name (to know which file.Rd it goes in), @aliases to make explicit the full method signature, and @export.

EG:

.big.extract <-  function (x, y,  ctstime = FALSE, fact = NULL, verbose = TRUE, ...) {
   ## etc.
}
##' @name extract
##' @export
##' @aliases extract,function,data.frame-method
setMethod("extract", signature(x = 'function', y = 'data.frame'), .big.extract)


https://stat.ethz.ch/R-manual/R-devel/library/methods/html/setMethod.html



No comments: