[Rd] R CMD check -- non S3 method warning

From: Whit Armstrong <armstrong.whit_at_gmail.com>
Date: Sat, 21 Apr 2012 09:18:03 -0400


I'm trying to R CMD check a package, and I'm getting the 'checking S3 generic/method consistency' warning.

I have written a function 'gamma.dist' which is _not_ an S3 method, but happens to collide with the 'gamma' function from the R::base namespace.

Is there a way of telling CMD check that the name is intentional and is not meant to be an S3 method?

My function is defined as follows:

gamma.dist <- function(x,alpha,beta,observed=FALSE) {

    attr(x,"distributed") <- "gamma"
    attr(x,"alpha") <- substitute(alpha)
    attr(x,"beta") <- substitute(beta)
    attr(x,"observed") <- observed
    attr(x,"env") <- new.env()

    class(x) <- "mcmc.object"
    x
}

with corresponding man page:

\name{normal.dist}
\alias{normal.dist}
\alias{uniform.dist}
\alias{gamma.dist}
\alias{bernoulli.dist}
\alias{binomial.dist}

...
...

\usage{
normal.dist(x, mu, tau, observed = FALSE) uniform.dist(x, lower, upper, observed = FALSE) gamma.dist(x, alpha, beta, observed = FALSE) bernoulli.dist(x, p, observed = FALSE)
binomial.dist(x, n, p, observed = FALSE) }

I am reluctant to change the name of the function b/c all my distribution methods use the same convention of 'distribution type'.dist.

Do CRAN maintainers view this warning as a blocker for the package (full make check output below, which includes a few additional warnings I'm in the process of fixing)?

Thanks,
Whit

See section ‘Generic functions and methods’ of the ‘Writing R Extensions’ manual.
* checking replacement functions ... OK

The \usage entries for S3 methods should use the \method markup and not their full name.
See the chapter ‘Writing R documentation files’ in the ‘Writing R Extensions’ manual.
* checking Rd contents ... OK

WARNING: There were 2 warnings.
NOTE: There were 2 notes.
See
  ‘/home/warmstrong/dvl/R.packages/rcppbugs.Rcheck/00check.log’ for details.

warmstrong_at_krypton:~/dvl/R.packages$ R
> gamma
function (x) .Primitive("gamma")



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat 21 Apr 2012 - 13:21:39 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 21 Apr 2012 - 17:30:49 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive