[R] weirdness in sourc()ing a dump() (bug?)
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Wed May 5 21:05:29 CEST 2004
Webb Sprague <wwsprague at 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"
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list