Re: [R] return from nested function?

2005-03-02 Thread Jan T. Kim
On Tue, Mar 01, 2005 at 11:21:44PM -0800, Seth Falcon wrote: On Feb 25, 2005, at 12:34 PM, [EMAIL PROTECTED] wrote: Is is possible from within a function to cause its caller to return()? This snippet may be of interest: f = function(x) { + print(f) + g(return()) + print(end of f)

Re: [R] return from nested function?

2005-03-02 Thread Seth Falcon
On Mar 2, 2005, at 4:13 AM, Jan T. Kim wrote: I may be dumb today, but doesn't that beg the question of how does g cause f not to return? No, I think my post doesn't really help you. In the context of a recursive function, the code I posted provides a way to jump out of the recursion which is a

Re: [R] return from nested function?

2005-03-01 Thread Seth Falcon
On Feb 25, 2005, at 12:34 PM, [EMAIL PROTECTED] wrote: Is is possible from within a function to cause its caller to return()? This snippet may be of interest: f = function(x) { + print(f) + g(return()) + print(end of f) + } g=function(x) {print(g) + x + print(end of g) + } f(1) [1] f [1] g NULL

[R] return from nested function?

2005-02-25 Thread jhallman
Is is possible from within a function to cause its caller to return()? I have a function that lets user make edits to certain objects, and then checks that the edited objects still make sense. If they don't, the function puts up a notifier that the edits are being discarded and then returns,

Re: [R] return from nested function?

2005-02-25 Thread Thomas Lumley
On Fri, 25 Feb 2005 [EMAIL PROTECTED] wrote: Is is possible from within a function to cause its caller to return()? Not as such. You probably want to signal and catch a condition. Look at ?tryCatch. -thomas I have a function that lets user make edits to certain objects, and then checks