[R] documenting overridden methods (for S4 classes)

Rajarshi Guha rguha at indiana.edu
Mon Oct 30 04:13:25 CET 2006


Hi, I'm trying to convert a package of mine to S4 classes and am
stumbling when trying to correctly document some overriden methods.

I have written methods that allow one to use 'length', and various
logical operators (|, &, etc) on my objects.

For example the code for my length method is:

setMethod('length', "fingerprint",
          function(x) {
            x at length
          })

and the Rd file for this method is

\name{length}
\usage{
  length(x)
}
\alias{length}
\alias{length,fingerprint-method}
\title{
  Fingerprint Bit Length
}
\description{
  Returns the length of the fingerprint. That is, this is the length of
  the entire bit string and not simply the number of bits that are on.
}

\arguments{
    \item{x}{
      An object of class \code{fingerprint}
    }
}
\value{
The length of the bit string
}
\keyword{logic}
\keyword{methods}
\author{Rajarshi Guha \email{rguha at indiana.edu}}

However, when I do R CMD check on the package I get the following error:

Functions/methods with usage in documentation object 'length' but not in code:
  length

I have also implemented the 'as.character'  method for my objects and I
get a similar error for it as well.

I tried building and installing the package to see if/how it might fail.
However when I did ?length, a popup came up asking me to choose which
length manpage to use, so it appears to work.

I just can't figure out what the problem is in the code (since the
documentation appears to be OK)

Any pointers would be appreciated.

Thanks,

-------------------------------------------------------------------
Rajarshi Guha <rguha at indiana.edu>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
Does Ramanujan know Polish?
-- E.B. Ross



More information about the R-help mailing list