[Rd] Show location of workspace image on quit?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri Jun 5 22:52:13 CEST 2009


Here's a replacement 'q' function that spits out the path of the
workspace image:

q = function (save = "default", status = 0, runLast = TRUE)
{
cat(paste("Workspace image is
",file.path(getwd(),formals(save.image)$file),'\n'))
flush.console()
.Internal(quit(save, status, runLast))
}

Note the trickiness for getting the file name - without diving into
internals I can't see how q() gets the filename so I'm just robbing
the default value from save.image. The flush.console makes sure the
path is printed before Windows shows the confirmation dialog. Yes it
would be nicer if the path was included on the dialog, but that's
about 100 times as much work as adding two lines to the existing q
definition.

Anyway, that does the job for me.

Barry



More information about the R-devel mailing list