[R] dump() bug?

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Wed Nov 27 09:48:42 CET 2002


It is not a bug, but it may not be intended.  It is a consequence of
namespaces.  Since dump is in base, it searches base before the user's
workspace.  That is something that seems only to be documented in NEWS.

I don't follow your use of `local' and `global'.  Your `local' copy is in
.GlobalEnv, the global environment aka workspace!

On Wed, 27 Nov 2002, Ray Brownrigg wrote:

> Is this a bug?  Certainly it was not expected.  dump() seems to prefer a
> global definition over a local one.  R 1.6.1 on Solaris 8 or NetBSD:
>
> > ls()
> character(0)
> > dump("D", "D.q")	# a global D() exists
> > system("cat D.q")
> "D" <-
> function (expr, name)
> .Internal(D(expr, name))
> > D <- function(x) print(x)	# now create a local one
> > ls()
> [1] "D"
> > dump("D", "D.q")
> > system("cat D.q")	# here's the surprise
> "D" <-
> function (expr, name)
> .Internal(D(expr, name))
> >
> The same thing happens with dump(list=ls(), "D.q").
>
> Ray Brownrigg
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
Brian D. Ripley,                  ripley at 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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list