Skip to content
Prev 4898 / 12125 Next

[R-pkg-devel] [External] Re: S3 generic/method consistency warning for formula method

Hi Brian,

I agree that the way R CMD check reports on this, can be improved. 
For your case (as far as I understand it), you can try dispatching explicitly on the first element of the dots by using the object argument of UseMethod. This works for me.

foo <- function(..., data){
  UseMethod("foo", ..1)
}

foo.factor <- function(..., data){
  x <- list(...)
  x$data <- data
  x
} 
foo.formula <- function(..., data){
  x <- list(...)
  x$data <- data
  x
}

Cheers
Joris

--
Joris Meys
Statistical consultant

Department of Data Analysis and Mathematical Modelling
Ghent University
Coupure Links 653, B-9000 Gent (Belgium)
------------------------------

Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php