Gordon Smyth
2003-Jun-07 14:16 UTC
[Rd] R CMD check: is it error to setMethod for class not currently defined?
Should R CMD check consider it an error to define a new method using setMethod for a class which is not currently defined? It seems to me that it would be best not to consider this an error. What currently happens in that setMethod issues a warning, quite correctly. This warning produces an object 'last.warning'. Then R CMD check issues a WARNING that 'last.warning' is an undocumented code object. Would it be a good idea to make R CMD check disregard the object 'last.warning' when checking for undocumented code objects? If people agree, I could try to make a patch for the R CMD check code. Gordon platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major 1 minor 7.0 year 2003 month 05 day 13 language R --------------------------------------------------------------------------------------- Dr Gordon K Smyth, Senior Research Scientist, Bioinformatics, Walter and Eliza Hall Institute of Medical Research, 1G Royal Parade, Parkville, Vic 3050, Australia Tel: (03) 9345 2326, Fax (03) 9347 0852, Email: smyth@wehi.edu.au, www: http://www.statsci.org
Kurt Hornik
2003-Jun-09 12:37 UTC
[Rd] R CMD check: is it error to setMethod for class not currently defined?
>>>>> Gordon Smyth writes:> Should R CMD check consider it an error to define a new method using > setMethod for a class which is not currently defined? It seems to me > that it would be best not to consider this an error.[R CMD check by itself definitely does not test for this.]> What currently happens in that setMethod issues a warning, quite > correctly. This warning produces an object 'last.warning'. Then R CMD > check issues a WARNING that 'last.warning' is an undocumented code > object.> Would it be a good idea to make R CMD check disregard the object > 'last.warning' when checking for undocumented code objects? If people > agree, I could try to make a patch for the R CMD check code.Why should it? Packages could have an object called last.warning in their environment---the last.warning created by warning() seems to end up in .GlobalEnv ... What seems to happen is that you have a package installed as a save image which at save time creates a warning and hence last.warning in .GlobalEnv. The way installing as a save image works everything in .GlobalEnv gets included in the package environment. If for some reason this produces something 'unwanted', it can still be removed e.g. from inside the package load hook(s) (e.g., your .First.lib()). The QC tools, when working on installed packages, simply load and attach them, and perform computations on what is available then. Best -k
Gordon Smyth
2003-Jun-10 07:48 UTC
[Rd] R CMD check: is it error to setMethod for class not currently defined?
At 04:37 PM 9/06/2003, you wrote:> >>>>> Gordon Smyth writes: > > > Should R CMD check consider it an error to define a new method using > > setMethod for a class which is not currently defined? It seems to me > > that it would be best not to consider this an error. > >[R CMD check by itself definitely does not test for this.] > > > What currently happens in that setMethod issues a warning, quite > > correctly. This warning produces an object 'last.warning'. Then R CMD > > check issues a WARNING that 'last.warning' is an undocumented code > > object. > > > Would it be a good idea to make R CMD check disregard the object > > 'last.warning' when checking for undocumented code objects? If people > > agree, I could try to make a patch for the R CMD check code. > >Why should it? Packages could have an object called last.warning in >their environment---the last.warning created by warning() seems to end >up in .GlobalEnv ... > >What seems to happen is that you have a package installed as a save >image which at save time creates a warning and hence last.warning in >.GlobalEnv. The way installing as a save image works everything in >.GlobalEnv gets included in the package environment. If for some reason >this produces something 'unwanted', it can still be removed e.g. from >inside the package load hook(s) (e.g., your .First.lib()). The QC >tools, when working on installed packages, simply load and attach them, >and perform computations on what is available then.Thanks for this. Including the code 'rm(last.warning)' in the right place solves the problem. Gordon>Best >-k
Apparently Analagous Threads
- Rcmd check does not recognize formal generic function as code object
- Using a function from splines.c in our package
- R 2.1.1: read.table processes C-style escapes (PR#8037)
- Infinite degrees of freedom for F-distribution
- formal methods and classes and capitalization conventions