Re: [R] Simple error handling in R

2010-11-16 Thread Gabor Grothendieck
On Tue, Nov 16, 2010 at 10:58 AM, Aleksey Naumov wrote: > Hi R experts, > > I am looking for a simple error handling approach, whereby I could stop > function execution with a customized error message. For example: > > for (i in 1:10) { >   if (i == 5) >      # I'd like to be able to stop right he

Re: [R] Simple error handling in R

2010-11-16 Thread Aleksey Naumov
Ottorino, Thank you for your suggestion. I am not really looking to do any debugging, but merely to issue an informative error message and stop execution of my top-level function, called at an R terminal. See me response to David for more details... Thank you, Aleksey On Tue, Nov 16, 2010 at 11:

[R] Simple error handling in R

2010-11-16 Thread Aleksey Naumov
David, Thank you for your help. I agree, "stop right here" is ambiguous, let me clarify. I am at a terminal session, calling my top-level function f(). At any point inside f() I'd like to be able to generate an error message, print it to the terminal and stop execution of f() (but still remain i

Re: [R] Simple error handling in R

2010-11-16 Thread ottorino
Il giorno mar, 16/11/2010 alle 10.58 -0500, Aleksey Naumov ha scritto: > for (i in 1:10) { >if (i == 5) > # I'd like to be able to stop right here with an error message I > have > complete control over > } I'm far from expert, but perhaps this is near what you are looking for for(i in

Re: [R] Simple error handling in R

2010-11-16 Thread David Winsemius
On Nov 16, 2010, at 10:58 AM, Aleksey Naumov wrote: Hi R experts, I am looking for a simple error handling approach, whereby I could stop function execution with a customized error message. For example: for (i in 1:10) { if (i == 5){ #Then insert: cat("Informative error message") ; bre

[R] Simple error handling in R

2010-11-16 Thread Aleksey Naumov
Hi R experts, I am looking for a simple error handling approach, whereby I could stop function execution with a customized error message. For example: for (i in 1:10) { if (i == 5) # I'd like to be able to stop right here with an error message I have complete control over } The problem