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