search for: onsessionexit

Displaying 3 results from an estimated 3 matches for "onsessionexit".

2005 Jun 10
1
Exiting R and package detachment?
...ge when R finishes. setHook(".Last", function(...) { pos <- match(paste("package:", pkgname, sep=""), search()); if (!is.na(pos)) detach(pos=pos); }) } However, this will be broken if user redefines .Last(). What about defining a hook "onSessionExit" to be called before (after?) .Last() is called. In analogue to on.exit() one could then define onSessionExit <- function(fcn, ...) { setHook("onSessionExit", fcn, ...); } Just curious, the above quote makes me wonder what is the rational for the behavior? Was it made on...
2008 Dec 20
1
Calling an R Exit Function
...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.
2006 Apr 10
2
Run package code on R shutdown?
I'm sure I've seen this discussed before, but haven't been able to find it. I'd like some package code to be run when R is shut down (approximately when a user's .Last function would be run), to clean up properly. What is the best way to do this? Duncan Murdoch