[R] source() function and crash of R!

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Feb 15 11:44:28 CET 2004



"Graciliano M. P." wrote:
> 
> > Do read the posting guide.
> >
> > I bet you get an error message, not a crash, and that you are running R in
> > non-interactive mode: not that you have told us what you are doing in any
> > detail.
> >
> 
> No, actually the R interpreter goes out, like if the process was killed!
> 
> Note that if we open R and type a code with an invalid syntax, R will just
> alert with some error msg. But when loaded with source(), this code makes
> the interpreter quit.
> 
> > ...you are running R in non-interactive mode...
> 
> What you mean with "non-interactive mode"?
>
> I'm running it from console. On Win32 Rterm, and linux just R. Here's the
> command to start it on Linux:
> 
>   $> R --slave --vanilla --gui=none <bridge.r >output.log


This is what Prof. Ripley (why do you reply in public to his private
message?) meant with "non-interactive", you do not interactively
communicate with R.

I also guess that R does NOT crash in your case:
If you use source(), this is a complete statement in R. If anything
sourced() produces an error (e.g. syntax error), the source() call exits
with this error. 
That is an expected behaviour. Functions are exiting if anything called
within that function got an error...
You should have seen the error message in output.log, but neither a
segmentation fault nor any other kind of a crash.

You can catch an error by using try(). See ?try.

Uwe Ligges




More information about the R-help mailing list