From mwtoews at sfu.ca  Sat Oct 21 02:32:01 2006
From: mwtoews at sfu.ca (Michael Toews)
Date: Fri, 20 Oct 2006 17:32:01 -0700
Subject: [Rd] parse/INSTALL feature request(s)
Message-ID: <45396A81.8080808@sfu.ca>

Hi,
I have a feature request for 'parse', and possibly the 'R CMD INSTALL' 
command to display more informative error information. Specifically, 
after making several modifications to a package on my system (the 
package name is irrelevant; I'm using R 2.3.1 on Debian):
$ R CMD INSTALL seas
* Installing *source* package 'seas' ...
** R
** data
** inst
** preparing package for lazy loading
Error in parse(file, n, text, prompt) : syntax error at
1222:       ylim <-
1223:     else
Execution halted
ERROR: lazy loading failed for package 'seas'
** Removing '/usr/local/lib/R/site-library/seas'

Of the 24 or so *.R source files in the edited package, I'm not sure 
where I had made the syntax error, but it would be very nice to see an 
error message that says something more helpful, such as "Error in 
parse(file, n, text, prompt) : syntax error in function 'foo' at ...". 
Is it possible for 'parse' to display the parent function name in which 
the error occurred? As for 'R CMD INSTALL' goes, I realize that all the 
*.R files are cat'ed together, then parsed as one file, so it is 
difficult report a file name and line number(s). Is this concatenating 
necessary? Or couldn't the individual files be parsed (and errors/line 
#'s reported for offending files), then combined in an environment for 
the INSTALL'ed package?

In the mean time, my solution to find the offending file is:
for(i in dir(pattern=".R$")){
    print(i)
    parse(i)
}

Thanks,
+mt




[Rd] parse/INSTALL feature request(s)
Michael Toews