[R] Error trapping in R
Bernard McGarvey
mcg@rvey@bern@rd @end|ng |rom comc@@t@net
Thu Feb 28 21:00:06 CET 2019
Thanks - the try() approach is exactly what I need.
Lion Bernard McGarvey
Director, Fort Myers Beach Lions Foundation, Inc.
Retired (Lilly Engineering Fellow).
> On February 27, 2019 at 4:39 PM Robert Knight <bobby.knight using gmail.com> wrote:
>
> Some use try blocks, like found in other languages. Put the code you want to try inside the block.
>
> https://www.robertknight.io/blog/try-blocks-in-r-for-error-handling/ contains a quick example. The example doesn’t raise exceptions or anything, it just contains it for you so the script keeps going. I like handling errors with if statements inside of try blocks.
>
> Robert
>
>
>
> On Feb 27, 2019, at 2:55 PM, Bernard Comcast < mcgarvey.bernard using comcast.net mailto:mcgarvey.bernard using comcast.net > wrote:
>
>
> > > What is the recommended way to trap errors in R? My main need is to be able to trap an error and then skip a section of code if an error has occurred. In VB for Excel I used the “On Error goto .....” construct to do this.
> >
> > Bernard
> > Sent from my iPhone so please excuse the spelling!"
> > ______________________________________________
> > R-help using r-project.org mailto:R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> > >
[[alternative HTML version deleted]]
More information about the R-help
mailing list