[R] S3 methods with several dots

Thomas Wutzler twutz at bgc-jena.mpg.de
Mon May 3 09:56:28 CEST 2010


Dear R-users,


I am confused about defining S3 methods when objects or methods involve
several dots. Here is my problem.

Package coda defines the following two generic methods:
as.mcmc(x,...)
as.mcmc.list(x,...)

I want to add an S3 method for the second method for my object of class
twDEMC
as.mcmc.list.twDEMC <- function(x,...)

R CMD check then warns:
* checking S3 generic/method consistency ... WARNING
as.mcmc:
  function(x)
as.mcmc.list.twDEMC:
  function(x, maxLength, thin, start, ...)

See section 'Generic functions and methods' of the 'Writing R Extensions'
manual.

I also tried to use setMethodS3 from R.oo package:
	setMethodS3("as.mcmc.list","twDEMC", function( x, ...){})
I also added "S3method(as.mcmc.list,twDEMC)" to the NAMESPACE file.

However, R CMD check still issues the warning.
How do I tell R (or check??) what is the generic and what the class?

(using Windows XP, R version 2.10.1)

Best regards
Thomas Wutzler



More information about the R-help mailing list