Skip to content

writintg wrappers around save()

3 messages · Vadim Ogranovich, Gabor Grothendieck, Brian Ripley

#
Try this:


save.verbose <- function(..., file) {
 cat("save.verbose:", file, "\n")
 eval.parent(substitute(save(..., file=file)))
}


On Fri, Mar 21, 2008 at 3:56 PM, Vadim Organovich
<vogranovich at jumptrading.com> wrote:
#
The names of the objects specified either as symbols (or character
      strings) in '...' or as a character vector in 'list' are used to
      look up the objects from environment 'envir'.

The default for envir is parent.frame().  You want to change it (and watch 
out that default and explicit arguments are evaluated in different 
places).  One approach is

save.verbose <- function(..., file, envir = parent.frame())
{
     cat("save.verbose:", file, "\n")
     save(..., file=file, envir=envir)
}
On Fri, 21 Mar 2008, Vadim Organovich wrote: