Tolga I Uzuner
2009-Jul-09 14:43 UTC
[R] executing an error prone function without stopping a script
Dear R Users, I've used this a long time ago but have forgotten. Trawling aroung the various sources somehow does not lead me to it. How can I execute an error prone function without stopping a script if it goes wrong ? Thanks in advance, Tolga This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. [[alternative HTML version deleted]]
Tolga I Uzuner
2009-Jul-09 16:31 UTC
[R] Executing an error prone function without stopping a script
Dear R Users, I've used this a long time ago but have forgotten. Trawling aroung the various sources somehow does not lead me to it. How can I execute an error prone function without stopping a script if it goes wrong ? Thanks in advance, Tolga This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. [[alternative HTML version deleted]]
cls59
2009-Jul-09 17:15 UTC
[R] executing an error prone function without stopping a script
TU wrote:> > Dear R Users, > > I've used this a long time ago but have forgotten. Trawling aroung the > various sources somehow does not lead me to it. How can I execute an error > prone function without stopping a script if it goes wrong ? > > Thanks in advance, > Tolga > >See ?try Basically, wrapping the function call in the try() function will make it so that errors do not halt your script: result <- try( function( args ) ) You can then handle errors in your own way: if( class(result) == 'try-error' ){ # Error handling stuff. } ----- Charlie Sharpsteen Undergraduate Environmental Resources Engineering Humboldt State University -- View this message in context: http://www.nabble.com/executing-an-error-prone-function-without-stopping-a-script-tp24413760p24414337.html Sent from the R help mailing list archive at Nabble.com.