[R] How to stop execution
Duncan Murdoch
murdoch at stats.uwo.ca
Sun Oct 15 19:39:39 CEST 2006
On 10/15/2006 1:19 PM, Fernando Saldanha wrote:
> I frequently run R code using source() or just paste large chunks of
> code into the console window. When there is an error in the code the
> execution does not stop. Rather, there is a blue error message and the
> remainder of the code continues to execute.
>
> Questions:
>
> 1) Is there a way to change the color of the error messages from blue
> to another color? There are other messages (not error messages) that
> are also blue and to have another color would make it easier to spot
> errors as the screen scrolls through the code.
No, there isn't.
> 2) Is there a way to make execution of the sourced or pasted code to
> stop immediatelyt if there is an error? I did some research and found
> a way to make the whole session end, but that is too radical. I also
> tried to change the option error from NULL to stop and that also does
> not do the trick: the remaining pasted or sourced code is still
> executed.
source() should stop when you get an error. Rather than pasting a lot
of text into the clipboard, if you want it to stop, you could use
source('clipboard')
or
source('clipboard', echo=T)
> Any help will be appreciated. I am running R version 2.3.0 on Windows
XP Pro.
My advice would be to upgrade to 2.4.0 (or at least 2.3.1).
Duncan Murdoch
More information about the R-help
mailing list