[R] Exception Handling
jim holtman
jholtman at gmail.com
Mon Jul 7 14:29:41 CEST 2008
It is probably not too difficult to do. You put the code that might
fail inside a "try({...})" and then test for failure. If it fails,
you can send an email and then continue to the next file. The actual
code would be dependent on where the error(s) might be occurring and
what you want to do on each condition, but 'try' is a reasonable
approach to solving the problem.
On Sun, Jul 6, 2008 at 7:36 PM, Tudor Bodea <gtg757i at mail.gatech.edu> wrote:
> Dear useRs:
>
> Please provide me with your thoughts on an issue related to the design of a
> production level system. For example, let's suppose that I need to run the
> same R script for a finite sequence of items (e.g., in the energy industry, I
> may need to asses the profitability of all gas stations in the state of
> Florida). For each of the items, the R script accesses some remote databases,
> gets all the necessary information and processes the data locally. If the
> data for every item in the item list were not corrupted then the R script
> would easily do its job. However, every now and then, the data for some items
> is partially missing and the R script returns in such cases an error message
> (e.g., for a given gas station, 1 month worth of data is missing from a 3
> month decision horizon). As of right now, using the error option of options
> (), whenever an exception happens, the R script sends me an email error
> message and kills the current R instance. As I already figured it out, this
> is not necessarily the most efficient way to deal with such exceptions.
> Ideally, I would like the script to inform me of the data problem but continue
> the analysis with the remaining of the items. Based on my searches, I believe
> that try / stop can answer my problem. However, if any of you already
> implemented such a safe fail system I would really appreciate your taking the
> time to (1) share with me what you think constitutes the best practices and/or
> (2) point out to me any online material relevant to the topic. I run various
> versions of R on Windows and multiple UNIX platforms. The list of items is
> read from a .csv file and stored in a dataframe.
>
> Thank you.
>
> Tudor
>
>
> --
> Tudor Dan Bodea
> Georgia Institute of Technology
> School of Civil and Environmental Engineering
> Web: http://www.prism.gatech.edu/~gtg757i
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
More information about the R-help
mailing list