Skip to content
Back to formatted view

Raw Message

Message-ID: <21105207.post@talk.nabble.com>
Date: 2008-12-20T13:52:57Z
From: PhilRack
Subject: Calling an R Exit Function

I'm looking for advice and suggestions on how I might be able to implement a
routine when R exits. First, I'm running on Windows XP SP2 using R 2.7.1. I
have a series of R programs that run numerous times a day. At the end of
each program, I have a call that appends a line of text to another file --
called completed.txt. for example,

cat("File Completed - WPS2R1 \n",file = "D:\\WPSWork\\WPS Temporary
Data\\_TD4216\\completed.txt ",append=TRUE)

I place this at the very end of my programs and this works fine if the
program doesn't terminate abnormally for some reason.

What I would like to do is whenever R runs my jobs, I would like to have
that line above execute whether the program runs to completion successfully
or not. Basically, I want to have the ability to invoke some type of exit
procedure that I can call to execute the above R statement. Honestly, I'm
confused on how to implement such a thing and how onSessionExit() might work
or if this is even the function I want to be calling.

Any suggestions are welcome.

Thanks,

Phil Rack
www.MineQuest.com
-- 
View this message in context: http://www.nabble.com/Calling-an-R-Exit-Function-tp21105207p21105207.html
Sent from the R help mailing list archive at Nabble.com.