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
>> 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
> -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
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 <-
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
5 matches
Mail list logo