Message-ID: <971536df0803211324k47f5e36hb454e6fe8109e0c1@mail.gmail.com>
Date: 2008-03-21T20:24:25Z
From: Gabor Grothendieck
Subject: writintg wrappers around save()
In-Reply-To: <22D850BC39A25742977325ADDE208E770266956312@chiexchange02.w2k.jumptrading.com>
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:
> Dear R-users,
>
> I am trying to write a wrapper function around save() that will report the file which is being saved to.
>
> So I thought that the followintg would do the trick, but it doesn't. I understand that 'y' is somehow not visible inside save.verbose, but don't know how to fix this.
>
> save.verbose <- function(..., file) {
> cat("save.verbose:", file, "\n")
> save(..., file=file)
> }
> > foo <- function(x) { y <- x; save.verbose('y', file='foo.rda') }; foo(1)
> save.verbose: foo.rda
> Error in save(..., file = file) : object 'y' not found
> Any suggestion how to fix this?
>
> Thank you for your time,
> Vadim
>
> P.S. I have a nagging feeling that I've already asked this question but I am not able to find any trace of it in the archives. My apologiesif this is so.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>