Re: [R] weirdness in sourc()ing a dump() (bug?)

About this list Date view Thread view Subject view Author view Attachment view

From: Prof Brian Ripley (ripley@stats.ox.ac.uk)
Date: Thu 06 May 2004 - 05:20:51 EST


Message-id: <Pine.LNX.4.44.0405052013000.31430-100000@gannet.stats>

I don't think it is a bug. Note that dump does not even claim to dump
lists let alone symbols, but ?dump says

     At present the implementation of 'dump' is very incomplete and it
     really only works for functions and simple vectors.

Given that, this is not unexpected. (Looks like more than one person did
not check the help page ....)

I think save/load is a much safer way to handle saving R objects, and it
does work in PD's example.

On 5 May 2004, Peter Dalgaard wrote:

> Webb Sprague <wwsprague@ucdavis.edu> writes:
>
> > return(list (DATA=my.data, MEANS=data.frame(EXT.CUT=means[,1],
> > MEAN=means[,2]), run.date=date(), call.list=as.list(match.call())))
> > </SNIP>
> >
> > As you can see, I am trying to return my call parameters as a list (so
> > I can write appropriate titles on my graphs). It works just fine when
> > do
>
> > Any thoughts? Seems like a bug in dump, and I would be happy to help
> > squash it if the right person gets hold of me.
>
> Yep, it's a bug. A minimal version is
>
> > f <- function()as.list(match.call())
> > dput(f())
> list(f)
>
> > dput(f(),"xx")
> > dget("xx")
> [[1]]
> function()as.list(match.call())
>
> (or an error if you remove f first). What should happen is probably
>
> > dput(f)
> list(as.name("f"))
>
> Similarly
>
> > f <- function()match.call()
> > dput(f())
> f()
> > dput(f(),"xx")
> > rm(f)
> > dget("xx")
> Error in eval(expr, envir, enclos) : couldn't find function "f"

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:07 EST