Skip to content
Prev 2504 / 21312 Next

[Bioc-devel] documentation help

Hi, Stefano

The way I handle this is to write the generic as you did..
Then have an S4 method defined as that takes the various optional arguments but dispatches on the generic signature..

setMethod("gcNorm",signature=c("objtype"), function(obj,optarg1,optarg2=,...){
#function definition
})

The method above is called when you pass an object of type "objtype" to gcNorm, and takes additional arguments optarg1, and optarg2


To document this, you'd have the following

\name{gcNorm}
\alias{gcNorm}
\alias{gcNorm-methods}
\alias{gcNorm,objtype-method}

\usage{
\S4method{gcNorm}{objtype}(obj,optarg1,optarg2,...)
}

\arguments{
\item{obj}{
}
\item{optarg1}{
}
\item{optarg2}{
}
\item{...}{
}
}
The main thing is that inside the usage tag you enclose the usage with \S4method which allows you to include the optional arguments. If they have default values, you would include them here, since the usage must match the function definition.

You could write other S4 methods that take different types of obj and other optional arguments and document them in the same file.

The aliases tell R's documentation system that this Rd file documents the gcNorm function as well as gcNorm methods and which gcNorm methods specifically (there's probably a more technical interpretation of this.. but it's how I think of it).

Cheers

Greg Finak

Sent from my iPhone
On 2011-03-09, at 4:27 AM, "Stefano Berri" <S.Berri at leeds.ac.uk> wrote: