From Mark.Bravington at csiro.au  Wed Aug 25 06:06:07 2010
From: Mark.Bravington at csiro.au (Mark.Bravington at csiro.au)
Date: Wed, 25 Aug 2010 14:06:07 +1000
Subject: [Rd] RCMD CHECK and non-methods
Message-ID: <62C82B39B8A85E4B95A18F7F7B852F870576DBBB76@exvic-mbx03.nexus.csiro.au>

I recently moved a function 'subset.with.warning' into the 'mvbutils' package (a version not yet on CRAN). When I tried RCMD CHECK, I got this warning:

	* checking S3 generic/method consistency ... WARNING
	subset:
	  function(x, ...)
	subset.with.warning:
	  function(x, cond, mess.head, mess.cond, row.info, sub)

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

I know that S3 method arguments need to be compatible with arguments of the generic. However, 'subset.with.warning' is deliberately not a registered S3 method, and its USAGE section doesn't include a \method{generic}{class} statement. I couldn't see anything in "R Extensions" that says "don't do this", so I'm wondering: 

 - should this really be a NOTE not a WARNING (or nothing at all)?

 - if not, shouldn't there be a more explicit statement to the effect that "if R decides it's a method, then it damned well is a method, whether you think it is or not"?

 - and if so, should there also be a check for functions that look like methods but aren't registered and declared as such?

My preference would be for the first, FWIW. Admittedly, just because I didn't register 'subset.with.warning' as an S3 method, that won't stop 'subset' from trying to use it if it ever encounters an object of class "with.warning". It's a risk that I'm happy to take, though CRAN might not be...

I made the warning go away by adding a '...' argument to the end of 'subset.with.warning', but that's not pretty.

Mark Bravington
CSIRO
Hobart
Australia

> sessionInfo()
R version 2.11.1 Patched (2010-06-30 r52418) 
i386-pc-mingw32 

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252    LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

attached base packages:
[1] grDevices tools     tcltk     stats     graphics  utils     methods   base     

other attached packages:
[1] ad_1.0         chstuff_1.0    handy2_1.2     tweedie_2.0.2  statmod_1.4.1  handy_1.1      debug_1.2.3    mvbutils_2.5.2
> 



[Rd] RCMD CHECK and non-methods
Mark.Bravington at csiro.au