Skip to content

Need to tell R CMD check that a function qr.R is not a method

7 messages · Tim Hesterberg, Uwe Ligges, Warnes, Gregory +3 more

#
On 07.09.2012 17:05, Tim Hesterberg wrote:
You can't. There are few exception for historic names (S definitions) 
hardcoded in R.

Best,
Uwe
#
On 9/7/12 12:55 PM, "Uwe Ligges" <ligges at statistik.tu-dortmund.de> wrote:

            
Would it be possible to add a \notmethod{} decorator to allow package
maintainers to avoid these messages?


-Greg
#
Would a workaround (for pleasing R CMD check) be to do:

qr.R <- function(...) UseMethod("qr.R", ...)

qr.R.qr <- function(qr, complete, pivot) {
  # No need to assert the class of 'qr' here.
  ...
}

Haven't tried it.  Method dispatching may also add unnecessary
overhead if called lots of times.

/Henrik


On Fri, Sep 7, 2012 at 9:55 AM, Uwe Ligges
<ligges at statistik.tu-dortmund.de> wrote:
#
On Sep 7, 2012, at 12:59 PM, "Warnes, Gregory" <gregory.warnes at novartis.com> wrote:

            
I would strongly support any solution since it has bitten me as well...
#
On 07/09/2012 2:00 PM, Simon Urbanek wrote:
An alternative would be to say that if it's not declared to be a method 
in the NAMESPACE file, it's not one.  I think that would actually be 
more work though, since it would probably break a lot of packages...

Duncan Murdoch
#
On Sep 7, 2012, at 2:14 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:

            
Yes, that's what I was expecting in the first place ...

(BTW: \function{} may be more natural than \notmethod{})
I wonder - those would already get a warning that they don't declare S3 methods properly so it may not be as surprising. Moreover it won't actually break anything at this point, just silence some warnings (unless we get to distinguish S3 methods from functions in S3 dispatch, but I last time I was told we are not anywhere close to a solution on that one ...).