Skip to content

bug in codetools/R CMD check?

5 messages · Luke Tierney, Hin-Tak Leung, Brian Ripley

#
Hi Mr Tierney,

I have noticed an error message from R 1.12.x's CMD check for a while (apparently prof Ripley completely rewrote CMD check in R 1.12+)
e.g.:
http://bioconductor.org/checkResults/2.7/bioc-LATEST/snpMatrix/lamb2-checksrc.html

----------------
* checking R code for possible problems ... NOTE
Warning: non-unique value when setting 'row.names': ?new?
Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "new", "new" : 
  duplicate 'row.names' are not allowed
Calls: <Anonymous> ... rownames<- -> row.names<- -> row.names<-.data.frame
Execution halted
-----------------

yet everything is okey dokey at http://bioconductor.org/checkResults/2.7/bioc-LATEST/#S under the snpMatrix entry.

I believe it might be a bug in codetools::incLocalSrcInfo (used by "R CMD check") and here is what I think the fix(?) - but I am not entirely sure what that routine does and why other package writers haven't noticed similiar problems before:

diff -ur codetools/R/codetools.R codetools-fix/R/codetools.R
--- codetools/R/codetools.R	2011-01-07 15:52:58.000000000 +0000
+++ codetools-fix/R/codetools.R	2011-02-03 10:03:54.000000000 +0000
@@ -823,8 +823,9 @@
     new <- list(srcfile = if (is.null(w$srcfile)) NA_character_ else w$srcfile,
                 frow = if (is.null(w$frow)) NA_integer_ else w$frow,
                 lrow = if (is.null(w$lrow)) NA_integer_ else w$lrow)
+    new <- as.data.frame(new, stringsAsFactors = FALSE)
     if (is.null(value))
-        value <- as.data.frame(new, stringsAsFactors = FALSE)
+        value <- new
     else
         value <- rbind(value, new)
     assign("srcinfo", value, entry)


Apply this "fix" would result in snpMatrix's "R CMD check" churning out:

---------------------
.ld.withmany: local variable ?names.components? assigned but may not be used
.ld.withmany: local variable ?nsnps.for.each? assigned but may not be used
misinherits: local variable ?nc.snps? assigned but may not be used
misinherits: local variable ?nr.snps? assigned but may not be used
qq.chisq: local variable ?lab? assigned but may not be used
read.HapMap.data: local variable ?base? assigned but may not be used
read.HapMap.data: local variable ?build? assigned but may not be used
read.HapMap.data: local variable ?finish? assigned but may not be used
read.HapMap.data: local variable ?strand? assigned but may not be used
tdt.snp: local variable ?nc.snps? assigned but may not be used
tdt.snp: local variable ?nr.snps? assigned but may not be used
---------------------

which is more like expected check warnings.

Care to comment?

Hin-Tak Leung
5 days later
#
Thanks -- will try to have a look sometime soon.

luke
On Thu, 3 Feb 2011, Hin-Tak Leung wrote:

            

  
    
#
--- On Tue, 8/2/11, luke-tierney at uiowa.edu <luke-tierney at uiowa.edu> wrote:

            
Thanks.

Also, regardless of whether that's a bug in codetools or snpMatrix (I am okay if you turn this around to say there is some coding style we shouldn't do in there, for which I'd apologize), there seems to be a small bug or inconsistency, and certainly in R or codetools, in that the codetools message is shown in all 4 platforms - linux, mac, win32, win64 - but the error status, whether it is correct or not, only propagate back up to the "R CMD check" harness in the case of win64 and not for the other 3 platforms. It should pass or fail with a warning consistently on all platforms.

Hin-Tak
#
On Tue, 8 Feb 2011, Hin-Tak Leung wrote:

            
Are you sure this is the same version of R and codetools?  If you mean 
BioC's check farm, that often has version skew.  I see the message 
consistently on all my platforms ....

  
    
#
--- On Tue, 8/2/11, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:

            
That's what I mean - the codetools message are seen consistently on all platforms, but the warning status only propagate back up to R CMD check (and resulted in a "1 warning" status) for win64 only; so R CMD check is behaving inconsistently, regardless of whether the message is genuine or not.

http://bioconductor.org/checkResults/2.7/bioc-LATEST/snpMatrix/gewurz-checksrc.html
* using R version 2.12.1 (2010-12-16)
* using platform: x86_64-pc-mingw32 (64-bit)
codetools message, status 1, 1 warning

http://bioconductor.org/checkResults/2.7/bioc-LATEST/snpMatrix/pelham-checksrc.html
* using R version 2.12.1 Patched (2010-12-17 r53867)
* using platform: i386-apple-darwin9.8.0 (32-bit)
codetools message, no error status, no warning

http://bioconductor.org/checkResults/2.7/bioc-LATEST/snpMatrix/liverpool-checksrc.html
* using R version 2.12.1 (2010-12-16)
* using platform: i386-pc-mingw32 (32-bit)
codetools message, status 1, no warning

http://bioconductor.org/checkResults/2.7/bioc-LATEST/snpMatrix/lamb2-checksrc.html
* using R version 2.12.1 (2010-12-16)
* using platform: x86_64-unknown-linux-gnu (64-bit)
codetools message, no error status, no warning


The mac OS X box has a slightly different version of R, but the other seems to be the same, and yet the error status and also whether the warning status is propate back is different. The codetools message is seen in all cases.

Hin-Tak