[Roxygen-devel] documenting multiple methods for a generic S4 method

Vinh Nguyen vqnguyen at uci.edu
Fri Oct 8 23:11:54 CEST 2010


Manuel wrote the following:

"
Hi Vinh,

the @rdname (only in Rd2) merges different documentations; so
setting

#' @rdname genF-methods

in front of every method should produce one Rd file with all
methods documented.


Manuel.
"

I've decided to write one documentation for a generic function, and
make use of aliases:

##' Inference for fitted model objects.
##'
##' Extract point estimates, standard errors, confidence intervals,
##' p-values, and sample size.
##' @rdname infer,-methods
##' @aliases infer infer,-method
##' @param fitobj Fitted model object, such as those of class \code{lm}.
##' @param vars Vector of variable names to obtain inference information
##' for.  Defaults to \code{NULL} which corresponds to all variables
##' in the fitted model.
##' @param robust.se Boolean indicator for whether robust standard
##' errors should be use.  Defaults to \code{TRUE}.
##' @param two.sided Boolean indicator for whether p-values should
##' correspond to a two-sided test or one-sided.  Defaults to
##' \code{TRUE}.
##' @param ci.level Confidence level.  Defaults to 0.95.
##' @return S4 \code{inference} object.
##' @examples
##' infer(lm(rnorm(100) ~ runif(100)))
##' @author Vinh Nguyen
setGeneric("infer", function(fitobj, ...) standardGeneric("infer"))

##' @rdname infer,-methods
setMethod("infer", signature(fitobj="lm"),...})

##' @rdname infer,-methods
setMethod("infer", signature(fitobj="glm"),...)

I just want to let everyone out there know that you still need to
declare @rdname for each of the setMethod, as leaving this out will
generate an "empty" (not much info) infer,-method.Rd file being
overwritten many times; I believe roxygen's default settings generate
an Rd file when it sees no roxygen documentation prior to the
setMethod definition.  This file will also have \alias{infer} in it,
which will take precedence when you type ?infer (so you'll see an
"empty" file).

Vinh


More information about the Roxygen-devel mailing list