[R] How-To capture and handle errors with R

Bernardo Rangel Tura tura at centroin.com.br
Sun Dec 14 11:16:33 CET 2008


On Fri, 2008-12-12 at 12:51 +0100, mauede at alice.it wrote:
> The following error occurs every now and then by calling a function of wmTSA package:
> 
> Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "0")) : 
>   invalid 'row.names' length
> 
> I would greatly appreciate some guidelines about how to catch such an error upon its occurrence and have it handled by my own routine 
> rather than letting R stop the currently run script.
> I had a look a the R on-line documentation about errors handler and also ran some provided examples that confused my mind.
> The error is in textual form. I do not know whether I have to pass the whole message to the handler.
> When such an exception occurs the execution control is not transferred to my routine.
> I would like to see a working example.
> 
> Thank you so much,
> Maura 

Maura you can use try to catch error for more information digit: ?try
-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil



More information about the R-help mailing list