[BioC] rcmd check does not recognize generic function definitions

Gordon Smyth smyth@wehi.edu.au
Tue, 18 Feb 2003 20:16:03 +1100


Dear all,

Thanks to Robert and Laurent for help. My repaired code is given below. 
RCMD check now runs the examples fine.

My question now is, how can I stop RCMD check from giving the warning that 
my generic function is documented but missing from the code? Is the format 
of my .Rd file correct? Here is the message:

    * checking for code/documentation mismatches ... WARNING
    Objects with usage in documentation object 'myGenericFun' but missing 
from code:
    [1] "myGenericFun"

Thanks
Gordon

-------------------------------- test.R -----------------------------
.initClassesandMethods <- function(where) {
setGeneric("myGenericFun",where=where,
         def=function(object) standardGeneric("myGenericFun"))
setMethod("myGenericFun","ANY",where=where,
         def=function(object) paste("myGenericFun on object of 
class",class(object))
)
setMethod("myGenericFun","matrix",where=where,
         def=function(object) "myGenericFun for matrices"
)
}

.First.lib <- function(libname, pkgname, where) {
         require(methods, quietly=TRUE)
#  Find what position in the search path this package is
         where <- match(paste("package:", pkgname, sep=""), search())
         .initClassesandMethods(where)
         cacheMetaData(as.environment(where))
}

------------------------- myGenericFun.Rd ------------------------
\name{myGenericFun}
\docType{methods}
\alias{myGenericFun}
\title{My Generic Function}
\description{A simple example generic function.}

\usage{myGenericFun(object)}

\arguments{
   \item{object}{Any R object. A special method exists for objects of class 
"matrix".}
}

\value{A character string explaining the class of object and the method 
dispatched.}

\examples{
x <- rnorm(10)
myGenericFun(x)
dim(x) <- c(5,2)
myGenericFun(x)
}

\keyword{models}