Re: [R] Stop and call objects

2011-01-06 Thread William Dunlap
From: Sebastien Bihorel [mailto:sebastien.biho...@cognigencorp.com] Sent: Thursday, January 06, 2011 1:37 PM To: William Dunlap Cc: Henrique Dallazuanna; Sebastien Bihorel; R-help Subject: Re: [R] Stop and call objects

Re: [R] Stop and call objects

2011-01-06 Thread Sebastien Bihorel
>> From: r-help-boun...@r-project.org >> [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique >> Dallazuanna >> Sent: Wednesday, January 05, 2011 9:26 AM >> To: Sebastien Bihorel >> Cc: R-help >> Subject: Re: [R] Stop and call objects >&g

Re: [R] Stop and call objects

2011-01-05 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique > Dallazuanna > Sent: Wednesday, January 05, 2011 9:26 AM > To: Sebastien Bihorel > Cc: R-help > Subject: Re: [R] Stop and call objec

Re: [R] Stop and call objects

2011-01-05 Thread Henrique Dallazuanna
Try this: f <- function(x) tryCatch(sum(x),error=function(e)sprintf("Error in %s: %s", deparse(sys.call(1)), e$message)) f('a') On Wed, Jan 5, 2011 at 12:23 PM, Sebastien Bihorel < sebastien.biho...@cognigencorp.com> wrote: > Dear R-users, > > Let's consider the following snippet: > > f <-

[R] Stop and call objects

2011-01-05 Thread Sebastien Bihorel
Dear R-users, Let's consider the following snippet: f <- function(x) tryCatch(sum(x),error=function(e) stop(e)) f('a') As expected, the last call returns an error message: Error in sum(x) : invalid 'type' (character) of argument My questions are the following: 1- can I easily ask the stop f