[R] Exception Handling

Tudor Bodea gtg757i at mail.gatech.edu
Mon Jul 7 01:36:35 CEST 2008


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



More information about the R-help mailing list