Re: [Rd] Run package code on R shutdown?

From: Henrik Bengtsson <hb_at_maths.lth.se>
Date: Mon 10 Apr 2006 - 13:08:00 GMT

On 4/10/06, Duncan Murdoch <murdoch@stats.uwo.ca> wrote:
> 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?

I tried to do this some time ago. My conclusion then is that it cannot be done with a guarantee, because R can exit in different ways.  I implemented what I had an came up with an onSessionExit() method available in R.utils. Check that out for a start. It modifies .Last(), but that can be circumvented by quit(callLast=FALSE).

/Henrik

> Duncan Murdoch
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

--
Henrik Bengtsson
Mobile: +46 708 909208 (+2h UTC)

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue Apr 11 00:49:48 2006

This archive was generated by hypermail 2.1.8 : Mon 10 Apr 2006 - 16:16:58 GMT