Many of my R scripts call other R scripts using the source function. If there is a syntax error in one of the scripts, I get an error message such as Error in parse(file, n, text, prompt) : syntax error on line 1 but the name of the file where the error occurs is not given. Other error messages such as Error in print(xxx) : Object "xxx" not found show neither the file name or the line number. Is there a way to get this information in error messages? I have found it helpful in other programming languages.
Gabor Grothendieck
2005-Apr-15 15:27 UTC
[R] line numbers and file names in error messages
On 4/15/05, Vivek Rao <rvivekrao at yahoo.com> wrote:> Many of my R scripts call other R scripts using the > source function. If there is a syntax error in one of > the scripts, I get an error message such as > > Error in parse(file, n, text, prompt) : syntax error > on line 1 > > but the name of the file where the error occurs is not > given. Other error messages such as > > Error in print(xxx) : Object "xxx" not found > > show neither the file name or the line number. Is > there a way to get this information in error messages? > I have found it helpful in other programming > languages.Perhaps at the end of each script you could add a print statement to tell you it had successfully finished.