[Rd] parse/INSTALL feature request(s)

Michael Toews mwtoews at sfu.ca
Sat Oct 21 02:32:01 CEST 2006


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




More information about the R-devel mailing list