[R] R CMD check, undoc and package checking

David Kane <David Kane a296180 at mica.fmr.com
Tue Nov 6 20:34:52 CET 2001


As cool and wonderful as the package checking tools for R are, I sometimes am
stymied when trying to track down a problem. For example, I occasionally see
error messages when running R CMD check like the following:

[...]
* checking Rd files ... OK
* checking for undocumented objects ... ERROR
*   in parse(file, n, text, prompt) : syntax error on line 932
*  in undoc(dir = "/home/a296180/tmp/pyri.port") : 

At this point, I want to go look at line 932 of some file. Question 1: Where is
this file? I wonder if this is connected to the tendency of R CMD check to
delete files when it finishes, even when there is an error. Going well beyond
my level of technical competence, I see in the code (lines 600-604)

        open Rout,  "< $Rout";
        while (<Rout>) {chomp; push(@out, $_);}
        close Rout;
        unlink($Rcmd);
        unlink($Rout);

Question 2: Is there some way (other than commenting out all the unlink
commands) to have R CMD check not delete any files? I suspect that this would
make searching for the problem easier in some cases.

Of course, I am given a clue because of the reference to undoc. I can then read
the help page and run undoc from the R prompt:

> undoc(dir= "/home/a296180/tmp/pyri.port")
Error in parse(file, n, text, prompt) : syntax error on line 932
Error in undoc(dir = "/home/a296180/tmp/pyri.port") : 
	cannot source package code

Again, I am sent to line 932, but still don't know what file to look
in. Looking into the undoc code, I see (line 455-458):

        if (file.exists(codeDir <- file.path(dir, "R"))) {
            codeFile <- tempfile("Rbuild")
            on.exit(unlink(codeFile))
            codeExts <- c("R", "r", "S", "s", "q")

It seems like the on.exit command is key. The error is in codeFile, but there is
no way to save codeFile, other than commenting out this line. When I do so, I
see, of course, that around line 932 is the following:

reporting <- function(mode,
                      univ = NULL
                      ...){

which is, indeed, an error (I need a comma after the NULL). However, finding
this error seemed harder than it should be.

Question 3: Am I missing something? Is there some methodology that I should be
following which would have made it much easier to discover the missing comma?


> version
         _                   
platform sparc-sun-solaris2.6
arch     sparc               
os       solaris2.6          
system   sparc, solaris2.6   
status                       
major    1                   
minor    3.1                 
year     2001                
month    08                  
day      31                  
language R                   
> 


Thanks,

Dave Kane
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list