[R] on error execute:

David Winsemius dwinsemius at comcast.net
Thu Sep 9 04:46:37 CEST 2010


On Sep 8, 2010, at 7:37 PM, jcress410 wrote:

>
> So, i've been writing code in R interfacing with mysql, its been fun  
> and the
> documentation has been useful, learning quite a bit.
>
> the only annoying thing i've been encountering is while coding/ 
> debugging, my
> session gets clogged, especially with sql connections.  At the end  
> of the
> code i dbDisconnect, but when the script is stopped by an error, the  
> session
> stays open.
>
> Usually i'll remember to ls() and dbDisconnect at console manually,  
> though,
> sometimes I forget and wind up with a bunch of extra connections.
>
> A couple of questions:
>
> First: is there a way to tell R to execute some commands before  
> dumping back
> to console on error,

?options

error:
	either a function or an expression governing the handling of non- 
catastrophic errors  ....<snipped rest of paragraph>
>
> and/or
>
> second: is there a way to capture error messages and continue  
> executing?

?try

>
> Sorry if this has been addressed already, but, even aided by the new  
> awesome
> google i haven't been able to find it.
> -- 


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list